|
1 /* |
|
2 * Copyright (c) 2002-2008 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: Implementation of CBrowserBookmarksView. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <cdownloadmgruidownloadslist.h> |
|
20 #include <cdownloadmgruidownloadmenu.h> |
|
21 #include <eikmenup.h> |
|
22 #include <aknsfld.h> |
|
23 #include <smut.h> |
|
24 #include <IrcMTM.h> |
|
25 |
|
26 #ifndef AVERELL2_BLUETOOTH_MISSING |
|
27 #include <btmsgtypeuid.h> |
|
28 #endif |
|
29 |
|
30 #include <irmsgtypeuid.h> |
|
31 #include <favouritesdb.h> |
|
32 |
|
33 #include <BrowserNG.rsg> |
|
34 |
|
35 #include <favouritesitem.h> |
|
36 #include <favouritesitemlist.h> |
|
37 #include <ApEngineConsts.h> |
|
38 #include <ApListItem.h> |
|
39 #include <ApListItemList.h> |
|
40 #include <StringLoader.h> |
|
41 #include <FeatMgr.h> |
|
42 #include <Uri16.h> |
|
43 #include <akntoolbar.h> |
|
44 #ifdef RD_SCALABLE_UI_V2 |
|
45 #include <akntoolbarextension.h> |
|
46 #endif |
|
47 |
|
48 |
|
49 #include "BrowserDialogs.h" |
|
50 #include "BrowserBookmarksView.h" |
|
51 #include "BrowserBookmarksContainer.h" |
|
52 #include "BrowserBookmarksModel.h" |
|
53 #include "BrowserFavouritesListbox.h" |
|
54 #include "BrowserBookmarksEditDialog.h" |
|
55 #include "BrowserBookmarksGotoPane.h" |
|
56 #include "CommonConstants.h" |
|
57 #include "BrowserUtil.h" |
|
58 #include "BrowserAppUi.h" |
|
59 #include "Browser.hrh" |
|
60 #include "CommandVisibility.h" |
|
61 #include "BrowserBmOTABinSender.h" |
|
62 #include "CommsModel.h" |
|
63 #include <mconnection.h> |
|
64 #include "BrowserUiVariant.hrh" |
|
65 #include "BrowserWindowManager.h" |
|
66 #include "BrowserWindow.h" |
|
67 #include "BrowserDownloadUtil.h" |
|
68 #include "Display.h" |
|
69 #include "logger.h" |
|
70 |
|
71 #include "eikon.hrh" |
|
72 |
|
73 |
|
74 // CONSTANTS |
|
75 const TInt KAdaptiveBookmarksFirstPositionInBMView = 0; |
|
76 const TInt KAdaptiveBookmarksSecondPositionInBMView = 1; |
|
77 |
|
78 const TInt KBrowserDesCArrayGranularity = 8; |
|
79 |
|
80 // ================= MEMBER FUNCTIONS ======================= |
|
81 |
|
82 // ---------------------------------------------------------------------------- |
|
83 // CBrowserBookmarksView::NewLC |
|
84 // ---------------------------------------------------------------------------- |
|
85 // |
|
86 CBrowserBookmarksView* CBrowserBookmarksView::NewLC( |
|
87 MApiProvider& aApiProvider, |
|
88 CRecentUrlStore& aRecentUrlStore, |
|
89 TInt aInitialFolderUid ) |
|
90 { |
|
91 CBrowserBookmarksView* view = new (ELeave) CBrowserBookmarksView( aApiProvider, |
|
92 aRecentUrlStore, |
|
93 aInitialFolderUid ); |
|
94 CleanupStack::PushL( view ); |
|
95 |
|
96 view->ConstructL( R_BROWSER_BOOKMARKS_VIEW ); |
|
97 |
|
98 return view; |
|
99 } |
|
100 |
|
101 // ---------------------------------------------------------------------------- |
|
102 // CBrowserBookmarksView::~CBrowserBookmarksView |
|
103 // ---------------------------------------------------------------------------- |
|
104 // |
|
105 CBrowserBookmarksView::~CBrowserBookmarksView() |
|
106 { |
|
107 LOG_ENTERFN("CBrowserBookmarksView::~CBrowserBookmarksView"); |
|
108 delete iDownloadsListExecuter; |
|
109 iDownloadsListExecuter = 0; |
|
110 |
|
111 if ( !ApiProvider().ExitInProgress() ) |
|
112 { |
|
113 // Remove observers only in destructor. See comment in ConstructL why. |
|
114 ApiProvider().Preferences().RemoveObserver( this ); |
|
115 ApiProvider().Connection().UnsetApChangeObserver(); |
|
116 } |
|
117 CBrowserBookmarksContainer* container = TheContainer(); |
|
118 if ( container ) |
|
119 { |
|
120 container->GotoPane()->SetGPObserver( NULL ); |
|
121 if( ApiProvider().Preferences().SearchFeature() ) |
|
122 container->SearchPane()->SetGPObserver( NULL ); |
|
123 } |
|
124 delete iDomainFolderName; |
|
125 delete iItemsToMove; |
|
126 delete iCurrentOrder; |
|
127 delete iEnteredURL; |
|
128 delete iAsyncComplete; |
|
129 BROWSER_LOG( ( _L("delete iEnteredUrl 1") ) ); |
|
130 iCursorPos = -1; |
|
131 } |
|
132 |
|
133 // ---------------------------------------------------------------------------- |
|
134 // CBrowserBookmarksView::UpdateGotoPaneL |
|
135 // ---------------------------------------------------------------------------- |
|
136 // |
|
137 void CBrowserBookmarksView::UpdateGotoPaneL() |
|
138 { |
|
139 LOG_ENTERFN("BookmarksView::UpdateGotoPaneL"); |
|
140 // Simulate cursor movement; that will cancel editing (if editing) |
|
141 // and refresh Goto Pane. |
|
142 if ( Container() ) |
|
143 { |
|
144 if ( iEnteredURL ) |
|
145 { |
|
146 BROWSER_LOG( ( _L("iEnteredUrl exists") ) ); |
|
147 if ( iCursorPos >=0 ) // update pane only once! |
|
148 { |
|
149 TheContainer()->GotoPane()->SetTextL( iEnteredURL->Des(), |
|
150 EFalse, |
|
151 EFalse ); |
|
152 |
|
153 CEikEdwin* editor = STATIC_CAST( CEikEdwin*, |
|
154 TheContainer()->GotoPane()->ComponentControl( 1 ) ); |
|
155 editor->SetCursorPosL( iCursorPos, EFalse ); |
|
156 iCursorPos = -1; |
|
157 TheContainer()->GotoPane()->SetFocus( ETrue ); |
|
158 } |
|
159 } |
|
160 else |
|
161 { |
|
162 Container()->HandleCursorChangedL( Container()->Listbox() ); |
|
163 } |
|
164 } |
|
165 } |
|
166 |
|
167 // -------------------------------------------------------------------------------- |
|
168 // CBrowserBookmarksView::DeleteItems |
|
169 // -------------------------------------------------------------------------------- |
|
170 // |
|
171 void CBrowserBookmarksView::DeleteItems( TInt aCommand ) |
|
172 { |
|
173 |
|
174 if (iHandleDeleteInProgress) |
|
175 return; |
|
176 |
|
177 iHandleDeleteInProgress = ETrue; |
|
178 |
|
179 const CFavouritesItem* item = Container()->Listbox()->CurrentItem(); |
|
180 |
|
181 if (!item) |
|
182 { |
|
183 return; |
|
184 } |
|
185 |
|
186 if ( item->ParentFolder() == KFavouritesAdaptiveItemsFolderUid ) |
|
187 { |
|
188 TBool confirm; |
|
189 CArrayPtr<const CFavouritesItem>* items = Container()->Listbox()->SelectedItemsLC(); |
|
190 |
|
191 if ( items->Count() == 1 ) |
|
192 { |
|
193 confirm = TBrowserDialogs::ConfirmQueryYesNoL( R_BROWSER_FAVOURITES_TEXT_QUERY_COMMON_CONF_DELETE, (*items)[0]->Name()); |
|
194 } |
|
195 else if (items->Count() > 1) |
|
196 { |
|
197 confirm = TBrowserDialogs::ConfirmQueryYesNoL( R_BROWSER_FAVOURITES_TEXT_DEL_ITEMS_QUERY, items->Count()); |
|
198 } |
|
199 else |
|
200 { |
|
201 confirm = EFalse; |
|
202 } |
|
203 |
|
204 if (confirm) |
|
205 { |
|
206 for ( TInt i = 0; i < items->Count(); i++ ) |
|
207 { |
|
208 iRecentUrlStore.DeleteData(items->At( i )->Url()); |
|
209 } |
|
210 Container()->Listbox()->View()->ClearSelection(); |
|
211 iSaveBMOrder = ETrue; |
|
212 RefreshL(); |
|
213 } |
|
214 |
|
215 CleanupStack::PopAndDestroy();//items |
|
216 } |
|
217 else |
|
218 { |
|
219 iSaveBMOrder = ETrue; |
|
220 CBrowserFavouritesView::HandleCommandL( aCommand ); |
|
221 } |
|
222 |
|
223 iHandleDeleteInProgress = EFalse; |
|
224 |
|
225 } |
|
226 |
|
227 // ---------------------------------------------------------------------------- |
|
228 // CBrowserBookmarksView::HandleCommandL |
|
229 // ---------------------------------------------------------------------------- |
|
230 // |
|
231 void CBrowserBookmarksView::HandleCommandL( TInt aCommand ) |
|
232 { |
|
233 LOG_ENTERFN("BookmarksView::HandleCommandL"); |
|
234 // |
|
235 // FIRST SWITCH Generic CBA commands to original commands |
|
236 // use ProcessCommandL to route through akn to make sure |
|
237 // command gets routed to the right place |
|
238 // |
|
239 // |
|
240 |
|
241 // Assume generic command unless default case, below. |
|
242 TBool genericCmdHandled = ETrue; |
|
243 |
|
244 switch ( aCommand ) |
|
245 { |
|
246 case EBrowserBookmarksCmdCancel: |
|
247 { |
|
248 if ( iManualItemMovingGoingOn ) |
|
249 { |
|
250 ProcessCommandL(EWmlCmdMoveCancel); |
|
251 } |
|
252 else if( TheContainer() |
|
253 && ( TheContainer()->GotoPane()->IsEditing() |
|
254 || TheContainer()->SearchPane()->IsEditing())) |
|
255 { |
|
256 ProcessCommandL(EWmlCmdGotoPaneCancel); |
|
257 } |
|
258 break; |
|
259 } |
|
260 case EBrowserBookmarksCmdOpen: |
|
261 { |
|
262 const CFavouritesItem* item = NULL; |
|
263 if (Container()) |
|
264 { |
|
265 item = Container()->Listbox()->CurrentItem(); |
|
266 } |
|
267 |
|
268 if ( item && item->IsFolder() ) |
|
269 { |
|
270 ProcessCommandL(EWmlCmdOpenFolder); |
|
271 } |
|
272 else |
|
273 { |
|
274 ProcessCommandL(EWmlCmdDownload); |
|
275 } |
|
276 |
|
277 break; |
|
278 } |
|
279 case EBrowserBookmarksCmdBack: |
|
280 { |
|
281 // default remap is to say back from folder |
|
282 TInt cmd = EWmlCmdBackFromFolder; |
|
283 |
|
284 // unless we have these conditions |
|
285 if ( !iInAdaptiveBookmarksFolder ) |
|
286 { |
|
287 if ( iCurrentFolder == KFavouritesRootUid ) |
|
288 { |
|
289 if ( ApiProvider().IsPageLoaded() || ApiProvider().Fetching() ) |
|
290 { |
|
291 cmd = EWmlCmdBackToPage; |
|
292 } |
|
293 } |
|
294 } |
|
295 ProcessCommandL(cmd); |
|
296 break; |
|
297 } |
|
298 default: |
|
299 { |
|
300 genericCmdHandled = EFalse; |
|
301 break; |
|
302 } |
|
303 } |
|
304 |
|
305 if (genericCmdHandled) |
|
306 { |
|
307 return; |
|
308 } |
|
309 |
|
310 // |
|
311 // EXISTING (regular) command set |
|
312 // |
|
313 if ( TheContainer() ) |
|
314 { |
|
315 switch ( aCommand ) |
|
316 { |
|
317 // CBA commands. |
|
318 case EWmlCmdGotoPaneGoTo: |
|
319 { |
|
320 if( TheContainer()->GotoPaneActive() ) |
|
321 { |
|
322 if (TheContainer()->GotoPane()->Editor()->TextLength()!= 0) |
|
323 { |
|
324 // Cancel editing and sets Goto Pane text back. |
|
325 if (TheContainer()->GotoPane()->PopupList() != NULL) |
|
326 { |
|
327 TheContainer()->GotoPane()->PopupList()->SetDirectoryModeL( ETrue ); |
|
328 TheContainer()->GotoPane()->PopupList()->HidePopupL(); |
|
329 } |
|
330 GotoUrlInGotoPaneL(); |
|
331 } |
|
332 } |
|
333 else // it was from searchpane |
|
334 { |
|
335 if (TheContainer()->SearchPane()->Editor()->TextLength()!= 0) |
|
336 { |
|
337 // Launch Search application with search parameters |
|
338 // and cancel editing of search and goto. |
|
339 // Dim Toolbar buttons |
|
340 DimToolbarButtons(EFalse); |
|
341 HBufC* searchString = TheContainer()->SearchPane()->GetTextL(); |
|
342 CleanupStack::PushL( searchString ); |
|
343 if( searchString ) |
|
344 { |
|
345 UpdateCbaL(); |
|
346 // Set GoTo/Search Inactive |
|
347 TheContainer()->SetGotoInactiveL(); |
|
348 LaunchSearchApplicationL( *searchString ); |
|
349 } |
|
350 CleanupStack::PopAndDestroy( searchString ); |
|
351 } |
|
352 // set LSK to GOTO now |
|
353 UpdateCbaL(); |
|
354 } |
|
355 break; |
|
356 } |
|
357 case EWmlCmdGotoPaneSelect: |
|
358 { |
|
359 if (TheContainer()->GotoPane()->Editor()->TextLength()!= 0) |
|
360 { |
|
361 // Cancel editing and sets Goto Pane text back. |
|
362 if (TheContainer()->GotoPane()->PopupList() != NULL) |
|
363 { |
|
364 TheContainer()->GotoPane()->PopupList()->SetDirectoryModeL( ETrue ); |
|
365 TheContainer()->GotoPane()->PopupList()->HidePopupL(); |
|
366 } |
|
367 // set LSK to GOTO now |
|
368 UpdateCbaL(); |
|
369 } |
|
370 break; |
|
371 } |
|
372 |
|
373 |
|
374 case EWmlCmdNewFolder: |
|
375 { |
|
376 TInt uid = CBrowserFavouritesView::AddNewFolderL( ); |
|
377 |
|
378 AddUidToLastPlaceToCurrentListL(uid); |
|
379 iRefresh = EFalse; |
|
380 Model().Database().SetData( CurrentFolder() , *iCurrentOrder ); |
|
381 break; |
|
382 } |
|
383 case EWmlCmdMove: |
|
384 { |
|
385 StartMoveItemsL(); |
|
386 break; |
|
387 } |
|
388 case EWmlCmdMoveOk: |
|
389 { |
|
390 MoveItemsL(); |
|
391 break; |
|
392 } |
|
393 case EWmlCmdMoveCancel: |
|
394 { |
|
395 CancelMoveItemsL(); |
|
396 break; |
|
397 } |
|
398 |
|
399 case EWmlCmdMoveToFolder: |
|
400 { |
|
401 iSaveBMOrder = ETrue; |
|
402 CBrowserFavouritesView::HandleCommandL(aCommand); |
|
403 break; |
|
404 } |
|
405 |
|
406 case EWmlCmdGotoPaneCancel: |
|
407 { |
|
408 // Cancel editing and sets Goto Pane text back. |
|
409 if (TheContainer()->GotoPane()->PopupList() != NULL) |
|
410 { |
|
411 TheContainer()->GotoPane()->PopupList()->SetDirectoryModeL( ETrue ); |
|
412 TheContainer()->GotoPane()->PopupList()->HidePopupL(); |
|
413 } |
|
414 delete iEnteredURL; |
|
415 iEnteredURL = NULL; |
|
416 BROWSER_LOG( ( _L("delete iEnteredUrl 2") ) ); |
|
417 iCursorPos = -1; |
|
418 |
|
419 TheContainer()->SetGotoInactiveL(); |
|
420 |
|
421 DimToolbarButtons(EFalse); |
|
422 |
|
423 break; |
|
424 } |
|
425 |
|
426 // Menu commands. |
|
427 case EWmlCmdFavourites: |
|
428 { |
|
429 if ( iInAdaptiveBookmarksFolder ) |
|
430 { |
|
431 ExitAdaptiveBookmarks(); |
|
432 } |
|
433 ApiProvider().SetViewToBeActivatedIfNeededL( KUidBrowserBookmarksViewId ); |
|
434 break; |
|
435 } |
|
436 |
|
437 case EWmlCmdBackToPage: |
|
438 { |
|
439 ApiProvider().SetViewToReturnOnClose( KUidBrowserBookmarksViewId ); |
|
440 ApiProvider().SetViewToBeActivatedIfNeededL( KUidBrowserContentViewId ); |
|
441 break; |
|
442 } |
|
443 |
|
444 case EWmlCmdDownload: |
|
445 case EWmlCmdDownloadPage: |
|
446 { |
|
447 ActivateCurrentBookmarkL(); |
|
448 break; |
|
449 } |
|
450 |
|
451 #ifdef __RSS_FEEDS |
|
452 case EWmlCmdOpenFeedsFolder: |
|
453 { |
|
454 //complete remaining startup in Browser and then proceed |
|
455 if ( !ApiProvider().StartedUp() ) |
|
456 ApiProvider().CompleteDelayedInit(); |
|
457 ApiProvider().FeedsClientUtilities().ShowFolderViewL(); |
|
458 break; |
|
459 } |
|
460 #endif // __RSS_FEEDS |
|
461 |
|
462 |
|
463 case EWmlCmdLaunchHomePage: |
|
464 { |
|
465 AppUi()->HandleCommandL( aCommand ); |
|
466 break; |
|
467 } |
|
468 |
|
469 case EWmlCmdOpenItem: |
|
470 { |
|
471 // re-handle the open item command depending on whether a folder or an |
|
472 // item is selected. |
|
473 if ( Container() && Container()->Listbox() ) |
|
474 { |
|
475 const CFavouritesItem* item = Container()->Listbox()->CurrentItem(); |
|
476 if ( item && item->IsFolder() ) |
|
477 { |
|
478 HandleCommandL(EWmlCmdOpenFolder); |
|
479 } |
|
480 else |
|
481 { |
|
482 HandleCommandL(EWmlCmdDownload); |
|
483 } |
|
484 } |
|
485 break; |
|
486 } |
|
487 |
|
488 case EWmlCmdAddBookmark: |
|
489 { |
|
490 AddNewBookmarkL(); |
|
491 break; |
|
492 } |
|
493 |
|
494 case EWmlCmdGoToAddressAndSearch: |
|
495 case EWmlCmdGoToAddress: // MSK for Recent Url page |
|
496 case EWmlCmdSwitchToGotoActive: |
|
497 { |
|
498 DimToolbarButtons(ETrue); |
|
499 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF |
|
500 CEikButtonGroupContainer* cba = Cba()->Current(); |
|
501 CEikCba* eikCba = static_cast<CEikCba*>( cba->ButtonGroup() ); |
|
502 if( eikCba ) |
|
503 { |
|
504 eikCba->EnableItemSpecificSoftkey( EFalse ); |
|
505 } |
|
506 #endif |
|
507 TheContainer()->SetGotoActiveL(); |
|
508 break; |
|
509 } |
|
510 |
|
511 case EIsCmdSearchWeb: |
|
512 { |
|
513 DimToolbarButtons(ETrue); |
|
514 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF |
|
515 CEikButtonGroupContainer* cba = Cba()->Current(); |
|
516 CEikCba* eikCba = static_cast<CEikCba*>( cba->ButtonGroup() ); |
|
517 if( eikCba ) |
|
518 { |
|
519 eikCba->EnableItemSpecificSoftkey( EFalse ); |
|
520 } |
|
521 #endif |
|
522 TheContainer()->SetSearchActiveL(); |
|
523 break; |
|
524 } |
|
525 |
|
526 case EWmlCmdEditBookmark: |
|
527 { |
|
528 EditCurrentBookmarkL(); |
|
529 break; |
|
530 } |
|
531 |
|
532 case EWmlCmdSetAsHomePage: |
|
533 { |
|
534 if ( Container() && Container()->Listbox() ) |
|
535 { |
|
536 const CFavouritesItem* item = |
|
537 Container()->Listbox()->CurrentItem(); |
|
538 if ( item && item->IsItem() && |
|
539 TBrowserDialogs::ConfirmQueryYesNoL( |
|
540 R_QTN_BROWSERBM_QUERY_SET_AS_HOME_PAGE ) ) |
|
541 { |
|
542 ApiProvider().Preferences().SetHomePageUrlL( item->Url() ); |
|
543 ApiProvider().Preferences().SetHomePageTypeL( EWmlSettingsHomePageAddress ); |
|
544 } |
|
545 } |
|
546 break; |
|
547 } |
|
548 |
|
549 case EWmlCmdPreferences: |
|
550 { |
|
551 CBrowserFavouritesView::HandleCommandL( aCommand ); |
|
552 break; |
|
553 } |
|
554 |
|
555 case EWmlCmdCopyToBookmarks: |
|
556 { |
|
557 CArrayPtr<const CFavouritesItem>* items = |
|
558 Container()->Listbox()->SelectedItemsLC(); |
|
559 if (items->Count()) |
|
560 { |
|
561 // Set WAP AP. |
|
562 CFavouritesItem* item; |
|
563 for (TInt i=0;i<items->Count();i++) |
|
564 { |
|
565 item = CFavouritesItem::NewL(); |
|
566 *item = *( items->At( i ) ); |
|
567 CleanupStack::PushL( item ); |
|
568 item->SetParentFolder( KFavouritesRootUid ); |
|
569 Model().AddL( *item, EFalse, CBrowserFavouritesModel::EAutoRename ); |
|
570 AddUidToLastPlaceToCurrentListL( item->Uid() ); |
|
571 CleanupStack::PopAndDestroy();//item |
|
572 } |
|
573 iRefresh = EFalse; |
|
574 Model().Database().SetData( CurrentFolder() , *iCurrentOrder ); |
|
575 Container()->Listbox()->View()->ClearSelection(); |
|
576 if (items->Count()==1) |
|
577 { |
|
578 TBrowserDialogs::InfoNoteL |
|
579 ( |
|
580 R_BROWSER_INFO_NOTE, |
|
581 R_BROWSER_ADAPTIVE_BOOKMARKS_ADAPTIVE_BOOKMARK_COPIED |
|
582 ); |
|
583 } |
|
584 else |
|
585 { |
|
586 TBrowserDialogs::InfoNoteL( |
|
587 R_BROWSER_INFO_NOTE, |
|
588 R_BROWSER_ADAPTIVE_BOOKMARKS_ADAPTIVE_BOOKMARKS_COPIED, |
|
589 items->Count() ); |
|
590 } |
|
591 } |
|
592 CleanupStack::PopAndDestroy();//items |
|
593 break; |
|
594 } |
|
595 |
|
596 case EWmlCmdRename: |
|
597 { |
|
598 // NO rename on menu |
|
599 { |
|
600 CBrowserFavouritesView::HandleCommandL( aCommand ); |
|
601 } |
|
602 break; |
|
603 } |
|
604 |
|
605 case EWmlCmdDelete: |
|
606 { |
|
607 DeleteItems( aCommand ); |
|
608 break; |
|
609 } // case |
|
610 |
|
611 |
|
612 case EWmlCmdClearAdaptiveBookmarks: |
|
613 { |
|
614 if ( TBrowserDialogs::ConfirmQueryYesNoL( |
|
615 R_BROWSER_ADAPTIVE_BOOKMARKS_DELETE_ALL_ADAPTIVE_BOOKMARKS) ) |
|
616 { |
|
617 ClearAdaptiveBookmarksL(); |
|
618 } |
|
619 break; |
|
620 } |
|
621 |
|
622 case EWmlCmdClearAdaptiveBookmarksNoPrompt: |
|
623 { |
|
624 ClearAdaptiveBookmarksL(); |
|
625 break; |
|
626 } |
|
627 |
|
628 case EWmlCmdOpenFolder: |
|
629 { |
|
630 if ( TheContainer()->GotoPane()->PopupList() ) |
|
631 { |
|
632 if ( TheContainer()->GotoPane()->PopupList()->IsPoppedUp() ) |
|
633 { |
|
634 TheContainer()->GotoPane()->PopupList()->SetDirectoryModeL( |
|
635 EFalse ); |
|
636 break; // This case is supposed to fall through into the next case in certain |
|
637 // conditions. |
|
638 } |
|
639 } |
|
640 } |
|
641 |
|
642 case EWmlCmdOpenMarkedFolder: |
|
643 { |
|
644 SetEmptyTextL(); |
|
645 if (Container()->Listbox()->CurrentItem()->Uid() == |
|
646 KFavouritesAdaptiveItemsFolderUid ) |
|
647 { |
|
648 iAdaptiveBookmarksFolderSelected = ETrue; |
|
649 iInAdaptiveBookmarksFolder = ETrue; |
|
650 SetEmptyTextL(); |
|
651 RefreshL(); |
|
652 } |
|
653 else |
|
654 { |
|
655 CBrowserFavouritesView::HandleCommandL( aCommand ); |
|
656 UpdateToolbarButtonsState(); |
|
657 } |
|
658 break; |
|
659 } |
|
660 |
|
661 case EWmlCmdBackFromFolder: |
|
662 { |
|
663 Container()->Listbox()->ClearSelection(); |
|
664 if ( iDomainFolderName ) |
|
665 { |
|
666 HBufC* domainFolderNameToHighlight; |
|
667 domainFolderNameToHighlight = HBufC::NewL( |
|
668 iDomainFolderName->Length() ); |
|
669 CleanupStack::PushL( domainFolderNameToHighlight ); |
|
670 |
|
671 domainFolderNameToHighlight->Des().Append( *iDomainFolderName ); |
|
672 delete iDomainFolderName; |
|
673 iDomainFolderName = NULL; |
|
674 |
|
675 CFavouritesItemList* items = |
|
676 GetItemsLC( KFavouritesAdaptiveItemsFolderUid ); |
|
677 TInt indexToHighlight = 0; |
|
678 |
|
679 for ( TInt i = 0; i < items->Count(); i++ ) |
|
680 { |
|
681 if ( (*items)[i]->Name() == (*domainFolderNameToHighlight) ) |
|
682 { |
|
683 indexToHighlight = i; |
|
684 } |
|
685 } |
|
686 |
|
687 CleanupStack::PopAndDestroy(); // items |
|
688 CleanupStack::PopAndDestroy(); // domainFolderNameToHighlight |
|
689 |
|
690 HBufC* title; |
|
691 title=iCoeEnv->AllocReadResourceLC( |
|
692 R_BROWSER_ADAPTIVE_BOOKMARKS_TITLE ); |
|
693 ApiProvider().Display().SetTitleL( *title ); |
|
694 CleanupStack::PopAndDestroy(); // title |
|
695 RefreshL(); |
|
696 Container()->Listbox()->SetCurrentItemIndexAndDraw( |
|
697 indexToHighlight ); |
|
698 } |
|
699 else |
|
700 { |
|
701 if ( iInAdaptiveBookmarksFolder ) |
|
702 { |
|
703 iAdaptiveBookmarksFolderSelected = EFalse; |
|
704 iInAdaptiveBookmarksFolder=EFalse; |
|
705 SetEmptyTextL(); |
|
706 HBufC* title; |
|
707 title=iCoeEnv->AllocReadResourceLC( |
|
708 TheContainer()->TitleResourceId() ); |
|
709 UpdateNaviPaneL(); |
|
710 ApiProvider().Display().SetTitleL( *title ); |
|
711 iPreferredHighlightUid=KFavouritesAdaptiveItemsFolderUid; |
|
712 CleanupStack::PopAndDestroy(); // title |
|
713 RefreshL(); |
|
714 } |
|
715 else |
|
716 { |
|
717 CBrowserFavouritesView::HandleCommandL( aCommand ); |
|
718 } |
|
719 } |
|
720 // Back from a folder may require change in toolbar button state |
|
721 UpdateToolbarButtonsState(); |
|
722 break; |
|
723 } |
|
724 |
|
725 case EWmlCmdSendBookmarkViaUnifiedMessage: |
|
726 { |
|
727 // Both case can be handled alike - SendBookmarksL |
|
728 // uses SelectedItemsLC - this always what we want (if there is |
|
729 // something marked, those; if no marked, the highlighted one). |
|
730 SendBookmarksL( ); |
|
731 break; |
|
732 } |
|
733 |
|
734 |
|
735 #ifdef __SERIES60_HELP |
|
736 case EAknCmdHelp: |
|
737 { |
|
738 STATIC_CAST(CBrowserAppUi*, AppUi())->HandleCommandL(EAknCmdHelp); |
|
739 break; |
|
740 } |
|
741 #endif //__SERIES60_HELP |
|
742 |
|
743 case EWmlCmdDownloads: |
|
744 { |
|
745 ApiProvider().BrCtlInterface().HandleCommandL( |
|
746 (TInt)TBrCtlDefs::ECommandShowDownloads + |
|
747 (TInt)TBrCtlDefs::ECommandIdBase ); |
|
748 break; |
|
749 } |
|
750 |
|
751 case EWmlCmdDownloadPageNewWindow: |
|
752 { |
|
753 const CFavouritesItem* item = Container()->Listbox()->CurrentItem(); |
|
754 if ( item ) |
|
755 { |
|
756 CBrowserAppUi::Static()->OpenLinkInNewWindowL( *item ); |
|
757 } |
|
758 break; |
|
759 } |
|
760 |
|
761 default: |
|
762 { |
|
763 if (aCommand == EWmlCmdDelete && |
|
764 (Container()->Listbox()->CurrentItem()->ParentFolder()==KFavouritesAdaptiveItemsFolderUid)) |
|
765 { |
|
766 DeleteItems( aCommand ); |
|
767 break; |
|
768 } |
|
769 CBrowserFavouritesView::HandleCommandL( aCommand ); |
|
770 break; |
|
771 } |
|
772 } |
|
773 } |
|
774 } |
|
775 |
|
776 // ---------------------------------------------------------------------------- |
|
777 // CBrowserBookmarksView::SetEmptyTextL |
|
778 // ---------------------------------------------------------------------------- |
|
779 // |
|
780 void CBrowserBookmarksView::SetEmptyTextL() |
|
781 { |
|
782 HBufC* buf; |
|
783 if (iInAdaptiveBookmarksFolder) |
|
784 { |
|
785 HBufC* title; |
|
786 if (iDomainFolderName != NULL) |
|
787 { |
|
788 ApiProvider().Display().SetTitleL( *iDomainFolderName ); |
|
789 } |
|
790 else |
|
791 { |
|
792 title=iCoeEnv->AllocReadResourceLC( R_BROWSER_ADAPTIVE_BOOKMARKS_TITLE ); |
|
793 ApiProvider().Display().SetTitleL( *title ); |
|
794 CleanupStack::PopAndDestroy(); // title |
|
795 } |
|
796 buf = iCoeEnv->AllocReadResourceLC( R_BROWSER_ADAPTIVE_BOOKMARKS_NO_ADAPTIVE_BOOKMARKS ); |
|
797 } |
|
798 else |
|
799 { |
|
800 buf = iCoeEnv->AllocReadResourceLC( TheContainer()->ListboxEmptyTextResourceId() ); |
|
801 } |
|
802 TheContainer()->Listbox()->View()->SetListEmptyTextL( *buf ); |
|
803 CleanupStack::PopAndDestroy(); // buf |
|
804 } |
|
805 |
|
806 // ---------------------------------------------------------------------------- |
|
807 // CBrowserBookmarksView::Id |
|
808 // ---------------------------------------------------------------------------- |
|
809 // |
|
810 TUid CBrowserBookmarksView::Id() const |
|
811 { |
|
812 return KUidBrowserBookmarksViewId; |
|
813 } |
|
814 |
|
815 // ---------------------------------------------------------------------------- |
|
816 // CBrowserBookmarksView::CommandSetResourceIdL |
|
817 // ---------------------------------------------------------------------------- |
|
818 // |
|
819 TInt CBrowserBookmarksView::CommandSetResourceIdL() |
|
820 { |
|
821 // massive re-work for 5.0, to dynamically assign CBA |
|
822 return(R_BROWSER_BUTTONS_CBA_DYNAMIC); |
|
823 } |
|
824 |
|
825 // ---------------------------------------------------------------------------- |
|
826 // CBrowserBookmarksView::CommandSetResourceDynL |
|
827 // ---------------------------------------------------------------------------- |
|
828 // |
|
829 |
|
830 void CBrowserBookmarksView::CommandSetResourceDynL(TSKPair& aLsk, TSKPair& aRsk, TSKPair& aMsk) |
|
831 { |
|
832 // |
|
833 // Get gotoPane pointer and appropriate Container pointer. |
|
834 // |
|
835 // These are passed in to the LSK, RSK, MSK dynamic setting functions |
|
836 // and used to help chose the appropriate softkeys |
|
837 // |
|
838 CBrowserBookmarksGotoPane* gotoPanePtr = NULL; |
|
839 CBrowserBookmarksContainer* theContainer = TheContainer(); |
|
840 |
|
841 // if the container doesn't exist, leave gotoPanePtr at NULL |
|
842 if (theContainer) |
|
843 { |
|
844 gotoPanePtr = theContainer->GotoPane(); |
|
845 } |
|
846 |
|
847 // set LSK, RSK, MSK respectively |
|
848 SetLSKDynL(aLsk, gotoPanePtr); |
|
849 SetRSKDynL(aRsk, gotoPanePtr); |
|
850 SetMSKDynL(aMsk, aLsk, theContainer, gotoPanePtr); |
|
851 |
|
852 // |
|
853 // Finally, if the contextual menu command was assigned to the MSK, |
|
854 // we need to set up the menu now |
|
855 // |
|
856 if ( aMsk.id() == EAknSoftkeyContextOptions ) |
|
857 { |
|
858 ConfigContextMenu(); |
|
859 } |
|
860 } |
|
861 |
|
862 // ---------------------------------------------------------------------------- |
|
863 // CBrowserBookmarksView::SetLSKDynL |
|
864 // ---------------------------------------------------------------------------- |
|
865 // |
|
866 |
|
867 void CBrowserBookmarksView::SetLSKDynL(TSKPair& aLsk, |
|
868 CBrowserBookmarksGotoPane* aGotoPane) |
|
869 { |
|
870 CBrowserBookmarksContainer* theContainer = TheContainer(); |
|
871 CBrowserBookmarksGotoPane* searchPane = NULL; |
|
872 if( theContainer ) |
|
873 { |
|
874 searchPane = theContainer->SearchPane(); |
|
875 } |
|
876 // Default lsk is option |
|
877 aLsk.setPair(EAknSoftkeyOptions, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_OPTION); |
|
878 |
|
879 if ( iManualItemMovingGoingOn ) |
|
880 { |
|
881 aLsk.setPair(EWmlCmdMoveOk, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_OK); |
|
882 } |
|
883 else if ( aGotoPane && aGotoPane->IsEditing() ) |
|
884 { |
|
885 // default for goto is go |
|
886 aLsk.setPair(EWmlCmdGotoPaneGoTo, R_BROWSER_BOOKMARKS_DYN_SK_QTN_WML_SOFTK_GO); |
|
887 |
|
888 if (aGotoPane->PopupList() && |
|
889 aGotoPane->PopupList()->IsOpenDirToShow() ) |
|
890 { |
|
891 aLsk.setPair(EBrowserBookmarksCmdOpen, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_OPEN); |
|
892 } |
|
893 else if (aGotoPane->PopupList() && |
|
894 aGotoPane->PopupList()->IsPoppedUp() && |
|
895 !iPenEnabled) |
|
896 { |
|
897 // LSK Select is only for non-touch devices |
|
898 aLsk.setPair(EWmlCmdGotoPaneSelect, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_SELECT); |
|
899 } |
|
900 } |
|
901 else if( searchPane && searchPane->IsEditing() ) |
|
902 { |
|
903 aLsk.setPair(EWmlCmdGotoPaneGoTo, R_BROWSER_BOOKMARKS_DYN_SK_QTN_IS_SOFTK_SEARCH); |
|
904 } |
|
905 } |
|
906 |
|
907 // ---------------------------------------------------------------------------- |
|
908 // CBrowserBookmarksView::SetRSKDynL |
|
909 // ---------------------------------------------------------------------------- |
|
910 // |
|
911 |
|
912 void CBrowserBookmarksView::SetRSKDynL(TSKPair& aRsk, |
|
913 CBrowserBookmarksGotoPane* aGotoPane) |
|
914 { |
|
915 CBrowserBookmarksContainer* theContainer = TheContainer(); |
|
916 CBrowserBookmarksGotoPane* searchPane = NULL; |
|
917 if( theContainer ) |
|
918 { |
|
919 searchPane = theContainer->SearchPane(); |
|
920 } |
|
921 if ( iManualItemMovingGoingOn ) |
|
922 { |
|
923 aRsk.setPair(EBrowserBookmarksCmdCancel, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_CANCEL); |
|
924 } |
|
925 else if( (aGotoPane && aGotoPane->IsEditing()) || (searchPane && searchPane->IsEditing()) ) |
|
926 { |
|
927 // default for goto is cancel |
|
928 aRsk.setPair(EBrowserBookmarksCmdCancel, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_CANCEL); |
|
929 } |
|
930 else |
|
931 { |
|
932 // default case for everything else is Back |
|
933 aRsk.setPair(EBrowserBookmarksCmdBack, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_BACK); |
|
934 |
|
935 // OR, it could be exit under these conditions |
|
936 if ( (!iInAdaptiveBookmarksFolder && !ApiProvider().IsPageLoaded() && !ApiProvider().Fetching()) ) |
|
937 { |
|
938 if ( iCurrentFolder == KFavouritesRootUid ) |
|
939 { |
|
940 aRsk.setPair(EAknSoftkeyExit, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_EXIT); |
|
941 } |
|
942 } |
|
943 } |
|
944 } |
|
945 |
|
946 // ---------------------------------------------------------------------------- |
|
947 // CBrowserBookmarksView::SetMSKDynL |
|
948 // ---------------------------------------------------------------------------- |
|
949 // |
|
950 |
|
951 void CBrowserBookmarksView::SetMSKDynL(TSKPair& aMsk, const TSKPair aLsk, |
|
952 CBrowserFavouritesContainer* aContainer, |
|
953 CBrowserBookmarksGotoPane* aGotoPane) |
|
954 { |
|
955 // setup any marked items flag for convenience |
|
956 // also verify that container is defined |
|
957 TBool anyMarkedItems = EFalse; |
|
958 if ( aContainer) |
|
959 { |
|
960 anyMarkedItems = aContainer->Listbox()->SelectionStateL().AnyMarked(); |
|
961 } |
|
962 else |
|
963 { |
|
964 return; |
|
965 } |
|
966 |
|
967 // |
|
968 // Usually, MSK is context menu if marked items. |
|
969 // The exception is if moving is in progress (and marked items).. then its the dot (in place of OK). |
|
970 // Otherwise, the Open Command is thrown. |
|
971 // |
|
972 if ( anyMarkedItems ) |
|
973 { |
|
974 if ( iManualItemMovingGoingOn ) |
|
975 { |
|
976 aMsk.setPair(EWmlCmdMoveOk, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_OK); |
|
977 } |
|
978 else |
|
979 { |
|
980 aMsk.setPair(EAknSoftkeyContextOptions, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_OPTION); |
|
981 } |
|
982 } |
|
983 else |
|
984 { |
|
985 aMsk.setPair(EBrowserBookmarksCmdOpen, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_OPEN); |
|
986 } |
|
987 |
|
988 CBrowserBookmarksContainer* theContainer = TheContainer(); |
|
989 CBrowserBookmarksGotoPane* searchPane = NULL; |
|
990 if( theContainer ) |
|
991 { |
|
992 searchPane = theContainer->SearchPane(); |
|
993 } |
|
994 // |
|
995 // UNDER these special conditions, the msk is set differently: |
|
996 // |
|
997 if ( aGotoPane && aGotoPane->IsEditing() ) |
|
998 { |
|
999 // follow whatever the lsk is set to |
|
1000 aMsk = aLsk; |
|
1001 } |
|
1002 else if( searchPane && searchPane->IsEditing() ) |
|
1003 { |
|
1004 // follow whatever the lsk is set to |
|
1005 aMsk = aLsk; |
|
1006 } |
|
1007 else |
|
1008 { |
|
1009 if ( iInAdaptiveBookmarksFolder ) |
|
1010 { |
|
1011 if ( aContainer->Listbox()->UnfilteredNumberOfItems() <= 0 ) |
|
1012 { |
|
1013 aMsk.setPair( EWmlCmdGoToAddress, R_BROWSER_BOOKMARKS_DYN_SK_QTN_BROWSER_MSK_GOTO ); |
|
1014 } |
|
1015 } |
|
1016 else |
|
1017 { |
|
1018 if ( (reinterpret_cast <CBrowserAppUi*>(AppUi())->IsEmbeddedModeOn()) || |
|
1019 iCurrentFolder == KFavouritesRootUid ) |
|
1020 { |
|
1021 if ( aContainer->Listbox()->UnfilteredNumberOfItems() <= 0 ) |
|
1022 { |
|
1023 aMsk.setPair( EWmlCmdAddBookmark, R_BROWSER_BOOKMARKS_DYN_SK_QTN_MSK_ADD ); |
|
1024 } |
|
1025 } |
|
1026 else |
|
1027 { |
|
1028 if ( aContainer->Listbox()->UnfilteredNumberOfItems() <= 0 ) |
|
1029 { |
|
1030 aMsk.setPair( EWmlCmdAddBookmark, R_BROWSER_BOOKMARKS_DYN_SK_QTN_MSK_ADD ); |
|
1031 } |
|
1032 } |
|
1033 } |
|
1034 } |
|
1035 } |
|
1036 |
|
1037 // ---------------------------------------------------------------------------- |
|
1038 // CBrowserBookmarksView::HandleBookmarksGotoPaneEventL |
|
1039 // ---------------------------------------------------------------------------- |
|
1040 // |
|
1041 void CBrowserBookmarksView::HandleBookmarksGotoPaneEventL |
|
1042 ( |
|
1043 CBrowserBookmarksGotoPane* |
|
1044 #ifdef _DEBUG |
|
1045 aGotoPane // used only for debugging purposes |
|
1046 #endif |
|
1047 , |
|
1048 MBookmarksGotoPaneObserver::TEvent aEvent |
|
1049 ) |
|
1050 { |
|
1051 #ifdef _DEBUG |
|
1052 __ASSERT_DEBUG( aGotoPane == TheContainer()->GotoPane() || |
|
1053 aGotoPane == TheContainer()->SearchPane(), \ |
|
1054 Util::Panic( Util::EFavouritesInternal ) ); |
|
1055 #endif |
|
1056 |
|
1057 switch ( aEvent ) |
|
1058 { |
|
1059 case MBookmarksGotoPaneObserver::EEventEnterKeyPressed: |
|
1060 { |
|
1061 HandleCommandL( EWmlCmdGotoPaneGoTo ); |
|
1062 break; |
|
1063 } |
|
1064 |
|
1065 case MBookmarksGotoPaneObserver::EEventEditingModeChanged: |
|
1066 { |
|
1067 UpdateCbaL(); |
|
1068 break; |
|
1069 } |
|
1070 |
|
1071 default: |
|
1072 { |
|
1073 break; |
|
1074 } |
|
1075 } |
|
1076 } |
|
1077 |
|
1078 // ---------------------------------------------------------------------------- |
|
1079 // CBrowserBookmarksView::CBrowserBookmarksView |
|
1080 // ---------------------------------------------------------------------------- |
|
1081 // |
|
1082 CBrowserBookmarksView::CBrowserBookmarksView ( MApiProvider& aApiProvider, |
|
1083 CRecentUrlStore& aRecentUrlStore, |
|
1084 TInt aInitialFolderUid ) |
|
1085 : CBrowserFavouritesView( aApiProvider, aInitialFolderUid ), |
|
1086 iFetchInit( EFalse ), |
|
1087 |
|
1088 iRecentUrlStore (aRecentUrlStore) |
|
1089 |
|
1090 |
|
1091 |
|
1092 { |
|
1093 // Initially start with default AP as Start Page AP. |
|
1094 iCurrentDefaultAp = iStartPageApUid = |
|
1095 ApiProvider().Preferences().DefaultAccessPoint(); |
|
1096 iPenEnabled = AknLayoutUtils::PenEnabled(); |
|
1097 iHandleDeleteInProgress = EFalse; |
|
1098 } |
|
1099 |
|
1100 // ---------------------------------------------------------------------------- |
|
1101 // CBrowserBookmarksView::ConstructL |
|
1102 // ---------------------------------------------------------------------------- |
|
1103 // |
|
1104 void CBrowserBookmarksView::ConstructL( TInt aViewResourceId ) |
|
1105 { |
|
1106 LOG_ENTERFN("BookmarksView::ConstructL"); |
|
1107 CBrowserFavouritesView::ConstructL( aViewResourceId ); |
|
1108 // Begin observing changes in active AP and default AP. Note that we |
|
1109 // set/unset observers here, not in DoActivateL/DoDeactivate: we do the |
|
1110 // observing even if the view is not active. This is needed, because |
|
1111 // preferences and the active AP can be changed from other views also. |
|
1112 // If notification kicks in when the view is not active, display RefreshL |
|
1113 // is, of course, suppressed (in base class). |
|
1114 ApiProvider().Preferences().AddObserverL( this ); |
|
1115 ApiProvider().Connection().SetApChangeObserver( *this ); |
|
1116 iOpenAdaptiveBookmarksWhenActivated = EFalse; |
|
1117 iAdaptiveBookmarksFolderSelected = EFalse; |
|
1118 iInAdaptiveBookmarksFolder=EFalse; |
|
1119 iAdaptiveBookmarksCurrentSetting = |
|
1120 ApiProvider().Preferences().AdaptiveBookmarks(); |
|
1121 iEnteredURL = NULL; |
|
1122 BROWSER_LOG( ( _L("delete iEnteredUrl 3") ) ); |
|
1123 iCursorPos = -1; |
|
1124 |
|
1125 //Since the webcore will be reading the bookmark information in background |
|
1126 //thread, its important to refresh when the thread notifies the fresh data. |
|
1127 //Call to GetItemsLC above, which inturn calls ManualBMSortL will set iRefresh to false |
|
1128 //Make it true so that latest FavIcon db info is shown |
|
1129 iRefresh = ETrue; |
|
1130 |
|
1131 #ifdef BRDO_PERF_IMPROVEMENTS_ENABLED_FF |
|
1132 if ( ApiProvider().Preferences().SearchFeature() ) // hide the button which is not needed |
|
1133 Toolbar()->HideItem( EWmlCmdGoToAddress, ETrue , EFalse); |
|
1134 else |
|
1135 Toolbar()->HideItem( EWmlCmdGoToAddressAndSearch, ETrue , EFalse); |
|
1136 #else |
|
1137 Toolbar()->HideItem( EWmlCmdAddBookmark, ETrue , EFalse); |
|
1138 |
|
1139 //disable both the goto items and activate one of them depending on availability of search feature during bookmarks activation |
|
1140 Toolbar()->HideItem( EWmlCmdGoToAddress, ETrue , EFalse); |
|
1141 Toolbar()->HideItem( EWmlCmdGoToAddressAndSearch, ETrue , EFalse ); |
|
1142 |
|
1143 #ifndef BRDO_SINGLE_CLICK_ENABLED_FF |
|
1144 Toolbar()->HideItem( EWmlCmdDelete, ETrue , EFalse); |
|
1145 #else |
|
1146 Toolbar()->HideItem( EWmlCmdPreferences, ETrue , EFalse); |
|
1147 #endif |
|
1148 |
|
1149 Cba()->MakeVisible( EFalse); |
|
1150 StatusPane()->MakeVisible( EFalse ); |
|
1151 #endif |
|
1152 |
|
1153 if (iPenEnabled) |
|
1154 { |
|
1155 Toolbar()->SetToolbarObserver(this); |
|
1156 } |
|
1157 } |
|
1158 |
|
1159 // ---------------------------------------------------------------------------- |
|
1160 // CBrowserBookmarksView::HandleListBoxEventL |
|
1161 // ---------------------------------------------------------------------------- |
|
1162 // |
|
1163 void CBrowserBookmarksView::HandleListBoxEventL( |
|
1164 CEikListBox* aListBox, |
|
1165 MEikListBoxObserver::TListBoxEvent aEventType ) |
|
1166 { |
|
1167 if ( aListBox == Container()->Listbox() ) |
|
1168 { |
|
1169 switch ( aEventType ) |
|
1170 { |
|
1171 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF |
|
1172 case MEikListBoxObserver::EEventEmptyListClicked: |
|
1173 return; |
|
1174 #endif |
|
1175 case MEikListBoxObserver::EEventEnterKeyPressed: |
|
1176 case MEikListBoxObserver::EEventItemDoubleClicked: |
|
1177 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF |
|
1178 case MEikListBoxObserver::EEventItemSingleClicked: |
|
1179 #endif |
|
1180 { |
|
1181 if ( iManualItemMovingGoingOn ) |
|
1182 { |
|
1183 MoveItemsL(); |
|
1184 return; |
|
1185 } |
|
1186 else if ( Container()->Listbox()->CurrentItem() ) |
|
1187 { |
|
1188 //complete remaining startup in Browser and then proceed |
|
1189 if ( !ApiProvider().StartedUp() ) |
|
1190 ApiProvider().CompleteDelayedInit(); |
|
1191 |
|
1192 if ( Container()->Listbox()->CurrentItem()->IsItem()) |
|
1193 { |
|
1194 ActivateCurrentBookmarkL(); |
|
1195 return; |
|
1196 } |
|
1197 else |
|
1198 { |
|
1199 if (Container()->Listbox()->CurrentItem()->Uid()==KFavouritesAdaptiveItemsFolderUid) |
|
1200 { |
|
1201 iAdaptiveBookmarksFolderSelected = ETrue; |
|
1202 iInAdaptiveBookmarksFolder=ETrue; |
|
1203 SetEmptyTextL(); |
|
1204 RefreshL(); |
|
1205 |
|
1206 iPreviousViewID = KUidBrowserBookmarksViewId; |
|
1207 return; |
|
1208 } |
|
1209 } |
|
1210 } |
|
1211 break; |
|
1212 } |
|
1213 default: |
|
1214 { |
|
1215 break; |
|
1216 } |
|
1217 } |
|
1218 } |
|
1219 |
|
1220 if ( TheContainer()->Listbox()->CurrentItem() && TheContainer()->Listbox()->CurrentItem()->IsFolder() ) |
|
1221 { |
|
1222 SetEmptyTextL(); |
|
1223 } |
|
1224 |
|
1225 CBrowserFavouritesView::HandleListBoxEventL( aListBox, aEventType ); |
|
1226 UpdateToolbarButtonsState(); |
|
1227 } |
|
1228 |
|
1229 // ---------------------------------------------------------------------------- |
|
1230 // CBrowserBookmarksView::DynInitMenuPaneL |
|
1231 // ---------------------------------------------------------------------------- |
|
1232 // |
|
1233 void CBrowserBookmarksView::DynInitMenuPaneL |
|
1234 ( |
|
1235 TInt aResourceId, |
|
1236 CEikMenuPane* aMenuPane, |
|
1237 TCommandVisibility::TIndex /*aIndex */, |
|
1238 const TBrowserFavouritesSelectionState& aState |
|
1239 ) |
|
1240 { |
|
1241 LOG_ENTERFN("CBrowserBookmarksView::DynInitMenuPaneL"); |
|
1242 |
|
1243 __ASSERT_DEBUG( (aMenuPane != NULL), Util::Panic( Util::EUninitializedData )); |
|
1244 |
|
1245 const CFavouritesItem* item = TheContainer()->Listbox()->CurrentItem(); |
|
1246 |
|
1247 switch ( aResourceId ) |
|
1248 { |
|
1249 case R_BROWSER_BOOKMARKS_MENU_PANE: |
|
1250 { |
|
1251 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF |
|
1252 if(iItemsToMove ) |
|
1253 { |
|
1254 aMenuPane->SetItemDimmed( EWmlCmdMove, ETrue ); |
|
1255 aMenuPane->SetItemDimmed( EWmlCmdMoveToFolder, ETrue ); |
|
1256 aMenuPane->SetItemDimmed( EWmlCmdDelete, ETrue ); |
|
1257 aMenuPane->SetItemDimmed( EWmlCmdSendAddressViaUnifiedMessage, ETrue ); |
|
1258 aMenuPane->SetItemDimmed( EWmlCmdSendBookmarkViaUnifiedMessage, ETrue ); |
|
1259 aMenuPane->SetItemDimmed( EWmlCmdSetAsHomePage, ETrue ); |
|
1260 } |
|
1261 else |
|
1262 { |
|
1263 if ( ApiProvider().Preferences().UiLocalFeatureSupported( KBrowserUiHomePageSetting ) ) |
|
1264 { |
|
1265 TBool dimSaveAsHomePage = EFalse; |
|
1266 |
|
1267 if ( (item && (item->IsFolder() || |
|
1268 item->Uid() == KFavouritesAdaptiveItemsFolderUid || |
|
1269 item->ContextId()))) |
|
1270 { |
|
1271 dimSaveAsHomePage = ETrue; |
|
1272 } |
|
1273 else |
|
1274 { |
|
1275 dimSaveAsHomePage = ApiProvider().IsEmbeddedModeOn() || !aState.CurrentIsItem() |
|
1276 || ( aState.MarkedCount() > 1 ); |
|
1277 } |
|
1278 |
|
1279 aMenuPane->SetItemDimmed( EWmlCmdSetAsHomePage, dimSaveAsHomePage ); |
|
1280 } |
|
1281 if (!item) |
|
1282 { |
|
1283 aMenuPane->SetItemDimmed( EWmlCmdSendBookmarkViaUnifiedMessage, ETrue ); |
|
1284 } |
|
1285 else if ( (item && (item->IsFolder() || |
|
1286 item->Uid() == KFavouritesAdaptiveItemsFolderUid || |
|
1287 item->ContextId()))) |
|
1288 { |
|
1289 aMenuPane->SetItemDimmed( EWmlCmdSendBookmarkViaUnifiedMessage, ETrue ); |
|
1290 } |
|
1291 } |
|
1292 |
|
1293 aMenuPane->SetItemDimmed( EWmlCmdSendAddressViaUnifiedMessage, ETrue ); |
|
1294 |
|
1295 if(iInAdaptiveBookmarksFolder) |
|
1296 { |
|
1297 aMenuPane->SetItemDimmed( EWmlCmdMove, ETrue ); |
|
1298 aMenuPane->SetItemDimmed( EWmlCmdMoveToFolder, ETrue ); |
|
1299 } |
|
1300 if ( ( item ) && |
|
1301 ( ( item->Uid() == KFavouritesAdaptiveItemsFolderUid ) || |
|
1302 ( item->ContextId() != NULL ) || |
|
1303 (item->IsReadOnly()) ) //If the bookmarks are the default provided by operator |
|
1304 ) |
|
1305 { |
|
1306 // We can't delete adaptive bookmarks folder, |
|
1307 // or seamless folders |
|
1308 aMenuPane->SetItemDimmed( EWmlCmdDelete, ETrue ); |
|
1309 aMenuPane->SetItemDimmed( EWmlCmdMoveToFolder, ETrue ); |
|
1310 } |
|
1311 if( item && item->IsFolder()) |
|
1312 { |
|
1313 aMenuPane->SetItemDimmed( EWmlCmdMoveToFolder, ETrue ); |
|
1314 } |
|
1315 |
|
1316 #endif |
|
1317 // downloads |
|
1318 if(ApiProvider().StartedUp()) |
|
1319 aMenuPane->SetItemDimmed( EWmlCmdDownloads, !ApiProvider().BrCtlInterface().BrowserSettingL( TBrCtlDefs::ESettingsNumOfDownloads ) ); |
|
1320 |
|
1321 // edit |
|
1322 if ( !item || (iInAdaptiveBookmarksFolder && aState.IsEmpty() )) |
|
1323 { |
|
1324 aMenuPane->SetItemDimmed( EWmlCmdManageBookmarks, ETrue ); |
|
1325 } |
|
1326 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF |
|
1327 // add bookmark |
|
1328 if ( iInAdaptiveBookmarksFolder ) |
|
1329 { |
|
1330 aMenuPane->SetItemDimmed( EWmlCmdAddBookmark, ETrue ); |
|
1331 } |
|
1332 |
|
1333 // create folder |
|
1334 if ( iCurrentFolder != KFavouritesRootUid || iInAdaptiveBookmarksFolder ) |
|
1335 { |
|
1336 aMenuPane->SetItemDimmed( EWmlCmdNewFolder, ETrue ); |
|
1337 } |
|
1338 #endif |
|
1339 |
|
1340 if ( iInAdaptiveBookmarksFolder && aState.IsEmpty() ) |
|
1341 { |
|
1342 aMenuPane->SetItemDimmed( EWmlCmdBmActions, ETrue ); |
|
1343 } |
|
1344 #ifndef BRDO_SINGLE_CLICK_ENABLED_FF |
|
1345 if (!item) |
|
1346 { |
|
1347 aMenuPane->SetItemDimmed( EWmlCmdMarkUnmark, ETrue ); |
|
1348 } |
|
1349 #endif |
|
1350 /* |
|
1351 if (BRDO_BROWSER_UPDATE_UI_FF) |
|
1352 { |
|
1353 aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue ); |
|
1354 } |
|
1355 else |
|
1356 { |
|
1357 aMenuPane->SetItemDimmed( EWmlCmdHelpMenu, ETrue ); |
|
1358 } |
|
1359 */ |
|
1360 break; |
|
1361 } |
|
1362 case R_GOTO_SUBMENU: |
|
1363 { |
|
1364 // back to page |
|
1365 if ( !ApiProvider().IsPageLoaded() && !ApiProvider().Fetching()) |
|
1366 { |
|
1367 aMenuPane->SetItemDimmed( EWmlCmdBackToPage, ETrue ); |
|
1368 } |
|
1369 |
|
1370 // bookmarks |
|
1371 aMenuPane->SetItemDimmed( EWmlCmdFavourites, ETrue ); |
|
1372 |
|
1373 // web feeds |
|
1374 if (ApiProvider().IsEmbeddedModeOn()) |
|
1375 { |
|
1376 aMenuPane->SetItemDimmed( EWmlCmdOpenFeedsFolder, ETrue ); |
|
1377 } |
|
1378 |
|
1379 // history |
|
1380 aMenuPane->SetItemDimmed( EWmlCmdHistory, ETrue ); |
|
1381 |
|
1382 // home |
|
1383 aMenuPane->SetItemDimmed( EWmlCmdLaunchHomePage, ETrue ); |
|
1384 //search |
|
1385 if ( ! ApiProvider().Preferences().SearchFeature() ) |
|
1386 { |
|
1387 aMenuPane->SetItemDimmed( EIsCmdSearchWeb, ETrue ); |
|
1388 } |
|
1389 break; |
|
1390 } |
|
1391 case R_BMACTIONS_SUBMENU: |
|
1392 { |
|
1393 #ifndef BRDO_SINGLE_CLICK_ENABLED_FF |
|
1394 // send |
|
1395 aMenuPane->SetItemDimmed( EWmlCmdSendAddressViaUnifiedMessage, ETrue ); |
|
1396 |
|
1397 if (!item) |
|
1398 { |
|
1399 aMenuPane->SetItemDimmed( EWmlCmdSendBookmarkViaUnifiedMessage, ETrue ); |
|
1400 } |
|
1401 else if ( (item && (item->IsFolder() || |
|
1402 item->Uid() == KFavouritesAdaptiveItemsFolderUid || |
|
1403 item->ContextId()))) |
|
1404 { |
|
1405 aMenuPane->SetItemDimmed( EWmlCmdSendBookmarkViaUnifiedMessage, ETrue ); |
|
1406 } |
|
1407 #endif |
|
1408 // copy to bookmarks |
|
1409 if ( !iInAdaptiveBookmarksFolder ) |
|
1410 { |
|
1411 aMenuPane->SetItemDimmed( EWmlCmdCopyToBookmarks, ETrue ); |
|
1412 } |
|
1413 #ifndef BRDO_SINGLE_CLICK_ENABLED_FF |
|
1414 // set as homepage |
|
1415 if ( ApiProvider().Preferences().UiLocalFeatureSupported( KBrowserUiHomePageSetting ) ) |
|
1416 { |
|
1417 TBool dimSaveAsHomePage = EFalse; |
|
1418 |
|
1419 if ( (item && (item->IsFolder() || |
|
1420 item->Uid() == KFavouritesAdaptiveItemsFolderUid || |
|
1421 item->ContextId()))) |
|
1422 { |
|
1423 dimSaveAsHomePage = ETrue; |
|
1424 } |
|
1425 else |
|
1426 { |
|
1427 dimSaveAsHomePage = ApiProvider().IsEmbeddedModeOn() || !aState.CurrentIsItem() |
|
1428 || ( aState.MarkedCount() > 1 ); |
|
1429 } |
|
1430 |
|
1431 aMenuPane->SetItemDimmed( EWmlCmdSetAsHomePage, dimSaveAsHomePage ); |
|
1432 } |
|
1433 // add bookmark |
|
1434 if ( iInAdaptiveBookmarksFolder ) |
|
1435 { |
|
1436 aMenuPane->SetItemDimmed( EWmlCmdAddBookmark, ETrue ); |
|
1437 } |
|
1438 #endif |
|
1439 // set preferred/unpreferred |
|
1440 if ( !iContainer->Listbox()->CurrentItem() ) |
|
1441 { |
|
1442 aMenuPane->SetItemDimmed( EWmlCmdSetPreferredBookmark, ETrue ); |
|
1443 aMenuPane->SetItemDimmed( EWmlCmdSetUnPreferredBookmark, ETrue ); |
|
1444 } |
|
1445 else |
|
1446 { |
|
1447 if ( ( iCurrentFolder == KFavouritesRootUid )|| |
|
1448 !iContainer->Listbox()->GetDefaultData().iInSeamlessFolder || |
|
1449 ( iContainer->Listbox()->GetDefaultData().iPreferedId == |
|
1450 iContainer->Listbox()->CurrentItem()->Uid() ) |
|
1451 ) |
|
1452 { |
|
1453 aMenuPane->SetItemDimmed( EWmlCmdSetPreferredBookmark, ETrue ); |
|
1454 } |
|
1455 |
|
1456 if ( ( iCurrentFolder == KFavouritesRootUid ) || |
|
1457 !iContainer->Listbox()->GetDefaultData().iInSeamlessFolder || |
|
1458 !( iContainer->Listbox()->GetDefaultData().iPreferedId == |
|
1459 iContainer->Listbox()->CurrentItem()->Uid() ) |
|
1460 ) |
|
1461 { |
|
1462 aMenuPane->SetItemDimmed( EWmlCmdSetUnPreferredBookmark, |
|
1463 ETrue ); |
|
1464 } |
|
1465 } |
|
1466 |
|
1467 break; |
|
1468 } |
|
1469 case R_BOOKMARKS_EDIT_SUBMENU: |
|
1470 { |
|
1471 // edit bookmark |
|
1472 if (!item || aState.MarkedCount() > 0) |
|
1473 { |
|
1474 aMenuPane->SetItemDimmed( EWmlCmdEditBookmark, ETrue ); |
|
1475 } |
|
1476 else if (( (item && (item->IsFolder() || |
|
1477 item->Uid() == KFavouritesAdaptiveItemsFolderUid || |
|
1478 item->ContextId() || aState.CurrentIsSpecial() || iInAdaptiveBookmarksFolder))) |
|
1479 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF |
|
1480 ||(item->IsReadOnly())//If the bookmarks are readonly(set by the operator) |
|
1481 #endif |
|
1482 ) |
|
1483 { |
|
1484 aMenuPane->SetItemDimmed( EWmlCmdEditBookmark, ETrue ); |
|
1485 } |
|
1486 |
|
1487 // rename |
|
1488 |
|
1489 // Can't rename recent urls and seamless folders - can only rename basic folders |
|
1490 if ( item->IsFolder() && |
|
1491 (item->Uid() != KFavouritesAdaptiveItemsFolderUid) && |
|
1492 (item->ContextId() == NULL) ) |
|
1493 { |
|
1494 // more item is marked -> dim rename |
|
1495 if ( aState.MarkedCount() > 0 ) |
|
1496 { |
|
1497 aMenuPane->SetItemDimmed( EWmlCmdRename, ETrue ); |
|
1498 } |
|
1499 } |
|
1500 else |
|
1501 { |
|
1502 aMenuPane->SetItemDimmed( EWmlCmdRename, ETrue ); |
|
1503 } |
|
1504 |
|
1505 #ifndef BRDO_SINGLE_CLICK_ENABLED_FF |
|
1506 // delete |
|
1507 if (!item) |
|
1508 { |
|
1509 aMenuPane->SetItemDimmed( EWmlCmdDelete, ETrue ); |
|
1510 } |
|
1511 else if ( item->Uid() == KFavouritesAdaptiveItemsFolderUid || |
|
1512 item->ContextId() || |
|
1513 !aState.AnyDeletable() ) |
|
1514 { |
|
1515 aMenuPane->SetItemDimmed( EWmlCmdDelete, ETrue ); |
|
1516 } |
|
1517 |
|
1518 // move |
|
1519 if ( iInAdaptiveBookmarksFolder || (TheContainer()->Listbox()->UnfilteredNumberOfItems() < 2 ) ) |
|
1520 { |
|
1521 aMenuPane->SetItemDimmed( EWmlCmdMove, ETrue ); |
|
1522 } |
|
1523 |
|
1524 // move to folder |
|
1525 if ( !aState.AnyPlainItem() || (iCurrentFolder == KFavouritesRootUid && |
|
1526 iContainer && iContainer->Listbox() && !iContainer->Listbox()->AnyFoldersL()) ) |
|
1527 { |
|
1528 aMenuPane->SetItemDimmed( EWmlCmdMoveToFolder, ETrue ); |
|
1529 } |
|
1530 // create folder |
|
1531 if ( iCurrentFolder != KFavouritesRootUid || iInAdaptiveBookmarksFolder ) |
|
1532 { |
|
1533 aMenuPane->SetItemDimmed( EWmlCmdNewFolder, ETrue ); |
|
1534 } |
|
1535 #endif |
|
1536 |
|
1537 break; |
|
1538 } |
|
1539 case R_BROWSER_FAVOURITES_MENU_PANE_MARK_UNMARK: |
|
1540 { |
|
1541 // For items and folders, show "Mark" or "Unmark". |
|
1542 aMenuPane->SetItemDimmed ( aState.CurrentIsMarked() ? EWmlCmdMark : EWmlCmdUnmark, ETrue ); |
|
1543 #ifndef SHOW_UNMARK_ALL_ALWAYS |
|
1544 |
|
1545 // We must show "Unmark all", even if nothing is marked. |
|
1546 // |
|
1547 // The case when there are no items at all, is not handled here: |
|
1548 // in that case we don't have "Edit list" menu. |
|
1549 if ( aState.NoneIsMarked() ) |
|
1550 { |
|
1551 aMenuPane->SetItemDimmed( EWmlCmdUnmarkAll, ETrue ); |
|
1552 } |
|
1553 #endif // SHOW_UNMARK_ALL_ALWAYS |
|
1554 |
|
1555 #ifndef SHOW_MARK_ALL_ALWAYS |
|
1556 // As for "mark all", consider items only. |
|
1557 if ( (aState.iVisibleItemCount == aState.iMarkedItemCount) && (aState.iVisibleFolderCount == aState.iMarkedFolderCount) ) |
|
1558 { |
|
1559 //Checking for both items and folders |
|
1560 aMenuPane->SetItemDimmed( EWmlCmdMarkAll, ETrue ); |
|
1561 } |
|
1562 else if( (aState.iVisibleItemCount == 0) && (aState.iVisibleFolderCount < 2))//Only one folder is present and no items |
|
1563 { |
|
1564 aMenuPane->SetItemDimmed( EWmlCmdMarkAll, ETrue ); |
|
1565 } |
|
1566 #endif // SHOW_MARK_ALL_ALWAYS |
|
1567 break; |
|
1568 } |
|
1569 case R_BROWSER_BOOKMARKS_MENU_PANE_OK: |
|
1570 { |
|
1571 // Bookmark-specific handling. |
|
1572 if ( aState.IsEmpty() || (TheContainer()->Listbox()->UnfilteredNumberOfItems() < 2)||iInAdaptiveBookmarksFolder) |
|
1573 { |
|
1574 aMenuPane->SetItemDimmed( EWmlCmdMove, ETrue ); |
|
1575 } |
|
1576 else |
|
1577 { |
|
1578 aMenuPane->SetItemDimmed( EWmlCmdMove, EFalse ); |
|
1579 } |
|
1580 |
|
1581 //Disable MoveToFolder option if you are in RecentlyVisitedUrl folder |
|
1582 if( iInAdaptiveBookmarksFolder ) |
|
1583 { |
|
1584 aMenuPane->SetItemDimmed( EWmlCmdMoveToFolder, ETrue ); |
|
1585 // These options are not required when user press MSK |
|
1586 aMenuPane->SetItemDimmed( EWmlCmdAddBookmark, ETrue ); |
|
1587 aMenuPane->SetItemDimmed( EWmlCmdCopyToBookmarks, ETrue ); |
|
1588 aMenuPane->SetItemDimmed( EWmlCmdSwitchToGotoActive, ETrue ); |
|
1589 aMenuPane->SetItemDimmed( EWmlCmdNewFolder, ETrue ); |
|
1590 } |
|
1591 |
|
1592 if( iContainer && iContainer->Listbox() && !iContainer->Listbox()->AnyFoldersL() ) |
|
1593 { |
|
1594 aMenuPane->SetItemDimmed( EWmlCmdMoveToFolder, ETrue ); |
|
1595 } |
|
1596 const CFavouritesItem* item = NULL; |
|
1597 if(TheContainer() && TheContainer()->Listbox()) |
|
1598 item = TheContainer()->Listbox()->CurrentItem(); |
|
1599 |
|
1600 if ( ( item ) && |
|
1601 ( ( item->Uid() == KFavouritesAdaptiveItemsFolderUid ) || |
|
1602 ( item->ContextId() != NULL ) ) |
|
1603 ) |
|
1604 { |
|
1605 // We can't delete adaptive bookmarks folder, |
|
1606 // or seamless folders |
|
1607 aMenuPane->SetItemDimmed( EWmlCmdDelete, ETrue ); |
|
1608 aMenuPane->SetItemDimmed( EWmlCmdMoveToFolder, ETrue ); |
|
1609 } |
|
1610 |
|
1611 //Enable CopyToBookmarks option if you are in RecentlyVisitedUrl folder |
|
1612 if( iInAdaptiveBookmarksFolder ) |
|
1613 { |
|
1614 aMenuPane->SetItemDimmed( EWmlCmdCopyToBookmarks, EFalse ); |
|
1615 } |
|
1616 //judge the selected items include RecentlyVisitedUrl folder or not, if include set "copy to bookmarks" dim |
|
1617 CArrayPtr<const CFavouritesItem>* items = Container()->Listbox()->SelectedItemsLC(); |
|
1618 if (items->Count()) |
|
1619 { |
|
1620 for (TInt i=0;i<items->Count();i++) |
|
1621 { |
|
1622 if((*items)[i]->Uid() == KFavouritesAdaptiveItemsFolderUid ) |
|
1623 { |
|
1624 aMenuPane->SetItemDimmed( EWmlCmdCopyToBookmarks, ETrue ); |
|
1625 } |
|
1626 } |
|
1627 } |
|
1628 CleanupStack::PopAndDestroy();//items |
|
1629 break; |
|
1630 } |
|
1631 default: |
|
1632 { |
|
1633 break; |
|
1634 } |
|
1635 } |
|
1636 } |
|
1637 |
|
1638 // ---------------------------------------------------------------------------- |
|
1639 // CBrowserBookmarksView::RootTitleResourceId |
|
1640 // ---------------------------------------------------------------------------- |
|
1641 // |
|
1642 TInt CBrowserBookmarksView::RootTitleResourceId() const |
|
1643 { |
|
1644 if ( iOpenAdaptiveBookmarksWhenActivated ) |
|
1645 { |
|
1646 return R_BROWSER_ADAPTIVE_BOOKMARKS_TITLE; |
|
1647 } |
|
1648 else |
|
1649 { |
|
1650 return R_BROWSER_OPTION_BOOKMARKS; |
|
1651 } |
|
1652 } |
|
1653 |
|
1654 // ---------------------------------------------------------------------------- |
|
1655 // CBrowserBookmarksView::OptionsMenuResourceId |
|
1656 // ---------------------------------------------------------------------------- |
|
1657 // |
|
1658 TInt CBrowserBookmarksView::OptionsMenuResourceId() const |
|
1659 { |
|
1660 return ( R_BROWSER_BOOKMARKS_MENU_BAR ); |
|
1661 } |
|
1662 |
|
1663 // ---------------------------------------------------------------------------- |
|
1664 // CBrowserBookmarksView::OkOptionsMenuResourceId |
|
1665 // ---------------------------------------------------------------------------- |
|
1666 // |
|
1667 TInt CBrowserBookmarksView::OkOptionsMenuResourceId() const |
|
1668 { |
|
1669 return R_BROWSER_BOOKMARKS_MENU_BAR_OK; |
|
1670 } |
|
1671 |
|
1672 // ---------------------------------------------------------------------------- |
|
1673 // CBrowserBookmarksView::CreateModelL |
|
1674 // ---------------------------------------------------------------------------- |
|
1675 // |
|
1676 CBrowserFavouritesModel* CBrowserBookmarksView::CreateModelL() |
|
1677 { |
|
1678 return CBrowserBookmarksModel::NewL(ApiProvider()); |
|
1679 } |
|
1680 |
|
1681 // ---------------------------------------------------------------------------- |
|
1682 // CBrowserBookmarksView::CreateContainerL |
|
1683 // ---------------------------------------------------------------------------- |
|
1684 |
|
1685 CBrowserFavouritesContainer* CBrowserBookmarksView::CreateContainerL() |
|
1686 { |
|
1687 CBrowserBookmarksContainer* container = |
|
1688 CBrowserBookmarksContainer::NewL( ClientRect(), *this ); |
|
1689 container->GotoPane()->SetGPObserver( this ); |
|
1690 if( ApiProvider().Preferences().SearchFeature() ) |
|
1691 container->SearchPane()->SetGPObserver( this ); |
|
1692 return container; |
|
1693 } |
|
1694 |
|
1695 // ---------------------------------------------------------------------------- |
|
1696 // CBrowserBookmarksView::MoveItemsL |
|
1697 // ---------------------------------------------------------------------------- |
|
1698 void CBrowserBookmarksView::MoveItemsL() |
|
1699 { |
|
1700 |
|
1701 // Get the Uid of currently highlighted bookmark item from listbox. |
|
1702 // NOTE: Listbox indexes is based on "visible" items in list box, our order |
|
1703 // array has visible and invisible items, we have to use Uid to find items. |
|
1704 const CFavouritesItem* toItem = Container()->Listbox()->CurrentItem(); |
|
1705 TInt toUid(NULL); |
|
1706 if ( toItem ) { |
|
1707 toUid = toItem->Uid(); |
|
1708 if (toUid == (*iItemsToMove)[0]) |
|
1709 { // Moving to same location so change nothing, cleanup, & exit |
|
1710 CancelMoveItemsL(); |
|
1711 return; |
|
1712 } |
|
1713 } |
|
1714 |
|
1715 // Get a copy of the ordered array, it may contain visible and hidden items. |
|
1716 CArrayFixFlat<TInt>* orderArray = |
|
1717 new (ELeave) CArrayFixFlat<TInt>(KGranularityHigh); |
|
1718 CleanupStack::PushL( orderArray ); |
|
1719 |
|
1720 orderArray->AppendL( & ( iCurrentOrder->GetBookMarksOrder()[0] ), |
|
1721 iCurrentOrder->GetBookMarksOrder().Count() ); |
|
1722 |
|
1723 if ( toUid == NULL ) { |
|
1724 toUid = (*orderArray)[orderArray->Count()-1] ; |
|
1725 } |
|
1726 |
|
1727 |
|
1728 // Create a sorted "bookmarks to be moved" array |
|
1729 CArrayFixFlat<TInt>* sortedItemsToMove = |
|
1730 new (ELeave) CArrayFixFlat<TInt>(KGranularityHigh); |
|
1731 CleanupStack::PushL( sortedItemsToMove ); |
|
1732 |
|
1733 |
|
1734 // Walk our copy of the ordered bookmark array and |
|
1735 // 1. Delete the bookmark items to be moved from the ordered array |
|
1736 // 2. Sort the bookmark items to be moved to match the visible order of the list |
|
1737 TInt i( 0 ); // index into order bookmark list |
|
1738 TInt j( 0 ); // index into sorted iItemsToMove |
|
1739 for ( i=0; i < orderArray->Count(); i++ ) { |
|
1740 TInt orderArrayUid = (*orderArray)[i]; |
|
1741 |
|
1742 // Find bookmark to be moved, sort and remove |
|
1743 for ( j=0; j < iItemsToMove->Count(); j++ ) { |
|
1744 if ( (*iItemsToMove)[j] == orderArrayUid ) { |
|
1745 sortedItemsToMove->AppendL( (*iItemsToMove)[j] ); |
|
1746 orderArray->Delete( i ); |
|
1747 i--; |
|
1748 break; |
|
1749 } |
|
1750 } |
|
1751 |
|
1752 // Stop sorting, if we're done |
|
1753 if ( iItemsToMove->Count() == sortedItemsToMove->Count() ) { |
|
1754 break; |
|
1755 } |
|
1756 } |
|
1757 |
|
1758 // Find the highlighted bookmark item and insert the newly ordered |
|
1759 // "bookmark items to be moved" in there |
|
1760 for ( i=0; i < orderArray->Count(); i++ ) { |
|
1761 if ( toUid == (*orderArray)[ i ] ) { |
|
1762 for ( j=0; j < sortedItemsToMove->Count(); j++ ) { |
|
1763 orderArray->InsertL( i+j, (*sortedItemsToMove)[j] ); |
|
1764 } |
|
1765 break; |
|
1766 } |
|
1767 } |
|
1768 |
|
1769 iCurrentOrder->SetBookMarksOrderL( *orderArray ); |
|
1770 Model().Database().SetData( CurrentFolder(), *iCurrentOrder ); |
|
1771 |
|
1772 iManualItemMovingGoingOn = EFalse; |
|
1773 Container()->Listbox()->ClearSelection(); |
|
1774 iPreferredHighlightUid = (*sortedItemsToMove)[0]; |
|
1775 |
|
1776 // Delete our arrays sortedItemsToMove, orderArray |
|
1777 CleanupStack::PopAndDestroy( 2 ); |
|
1778 delete iItemsToMove; |
|
1779 iItemsToMove = NULL; |
|
1780 |
|
1781 UpdateCbaL(); |
|
1782 // UnDim Toolbar buttons |
|
1783 DimToolbarButtons(EFalse); |
|
1784 |
|
1785 } |
|
1786 |
|
1787 // ---------------------------------------------------------------------------- |
|
1788 // CBrowserBookmarksView::CancelMoveItems |
|
1789 // ---------------------------------------------------------------------------- |
|
1790 // |
|
1791 void CBrowserBookmarksView::CancelMoveItemsL() |
|
1792 { |
|
1793 iManualItemMovingGoingOn = EFalse; |
|
1794 HandleCommandL(EWmlCmdUnmarkAll); |
|
1795 UpdateCbaL(); |
|
1796 // UnDim Toolbar buttons |
|
1797 DimToolbarButtons(EFalse); |
|
1798 iPreferredHighlightUid = ( *iItemsToMove )[0]; |
|
1799 delete iItemsToMove; |
|
1800 iItemsToMove = NULL; |
|
1801 RefreshL(); |
|
1802 } |
|
1803 |
|
1804 |
|
1805 // ---------------------------------------------------------------------------- |
|
1806 // CBrowserBookmarksView::StartMoveItems |
|
1807 // ---------------------------------------------------------------------------- |
|
1808 // |
|
1809 void CBrowserBookmarksView::StartMoveItemsL() |
|
1810 { |
|
1811 iManualItemMovingGoingOn = ETrue; |
|
1812 |
|
1813 TInt moveFrom = ( *Container()->Listbox()->SelectedRealIndexesLC() )[0]; |
|
1814 CleanupStack::PopAndDestroy(); //SelectedRealIndexesLC |
|
1815 TInt count = Container()->Listbox()->SelectedRealIndexesLC()->Count(); |
|
1816 CleanupStack::PopAndDestroy(); //SelectedRealIndexesLC |
|
1817 if ( ( count == 1 ) |
|
1818 && ( Container()->Listbox()->CurrentItemRealIndex() == moveFrom ) ) |
|
1819 { |
|
1820 HandleCommandL(EWmlCmdMark); |
|
1821 } |
|
1822 |
|
1823 |
|
1824 if (iItemsToMove) |
|
1825 { |
|
1826 delete iItemsToMove; |
|
1827 iItemsToMove = NULL; |
|
1828 } |
|
1829 iItemsToMove = new (ELeave) CArrayFixFlat<TInt>( KGranularityHigh ); |
|
1830 |
|
1831 CArrayPtr<const CFavouritesItem>* items = |
|
1832 Container()->Listbox()->SelectedItemsLC(); |
|
1833 |
|
1834 for ( TInt i = 0; i < items->Count(); i++ ) |
|
1835 { |
|
1836 iItemsToMove->AppendL( (*(*items)[i]).Uid() ); |
|
1837 } |
|
1838 CleanupStack::PopAndDestroy(items); |
|
1839 UpdateCbaL(); |
|
1840 // Dim Toolbar buttons |
|
1841 DimToolbarButtons(ETrue); |
|
1842 } |
|
1843 |
|
1844 // ---------------------------------------------------------------------------- |
|
1845 // CBrowserBookmarksView::ManualBMSortL |
|
1846 // ---------------------------------------------------------------------------- |
|
1847 // |
|
1848 TBool CBrowserBookmarksView::ManualBMSortL( TInt aFolder, |
|
1849 CFavouritesItemList* aItems ) |
|
1850 { |
|
1851 __ASSERT_DEBUG( (aItems != NULL), Util::Panic( Util::EUninitializedData )); |
|
1852 |
|
1853 delete iCurrentOrder; |
|
1854 iCurrentOrder = NULL; |
|
1855 iCurrentOrder = CBrowserBookmarksOrder::NewLC(); |
|
1856 CleanupStack::Pop(); |
|
1857 if ( aItems->Count() ) |
|
1858 { |
|
1859 CArrayFixFlat<TInt>* orderArray = new (ELeave) CArrayFixFlat<TInt>(KGranularityHigh); |
|
1860 CleanupStack::PushL(orderArray); |
|
1861 |
|
1862 if ( !Model().Database().GetData( aFolder ,*iCurrentOrder ) ) |
|
1863 { |
|
1864 if ( iCurrentOrder->GetBookMarksOrder().Count() > 0 ) |
|
1865 { |
|
1866 orderArray->AppendL( & ( iCurrentOrder->GetBookMarksOrder()[0] ), |
|
1867 iCurrentOrder->GetBookMarksOrder().Count()); |
|
1868 |
|
1869 if ( aFolder == KFavouritesRootUid ) |
|
1870 { |
|
1871 TInt i = 0; |
|
1872 |
|
1873 while ( i < orderArray->Count() && |
|
1874 !( (*orderArray)[i] == KFavouritesStartPageUid )) |
|
1875 { |
|
1876 i++; |
|
1877 } |
|
1878 |
|
1879 if ( i == orderArray->Count() ) |
|
1880 { |
|
1881 if ( iStartPagePresent ) |
|
1882 { |
|
1883 orderArray->InsertL( 0, KFavouritesStartPageUid ); |
|
1884 iSaveBMOrder = ETrue; |
|
1885 } |
|
1886 } |
|
1887 else |
|
1888 { |
|
1889 if ( !iStartPagePresent ) |
|
1890 { |
|
1891 orderArray->Delete(i); |
|
1892 iSaveBMOrder = ETrue; |
|
1893 } |
|
1894 } |
|
1895 if ( iInsertAdaptiveBookmarksFolder ) |
|
1896 { |
|
1897 iInsertAdaptiveBookmarksFolder = EFalse; |
|
1898 i = 0; |
|
1899 |
|
1900 while ( i < orderArray->Count() && |
|
1901 !( (*orderArray)[i] == |
|
1902 KFavouritesAdaptiveItemsFolderUid )) |
|
1903 { |
|
1904 i++; |
|
1905 } |
|
1906 |
|
1907 if ( i < orderArray->Count() ) |
|
1908 { |
|
1909 orderArray->Delete(i); |
|
1910 } |
|
1911 if ( orderArray->Count() ) |
|
1912 { |
|
1913 if ( (*orderArray)[0] == KFavouritesStartPageUid ) |
|
1914 { |
|
1915 orderArray->InsertL( 1, |
|
1916 KFavouritesAdaptiveItemsFolderUid ); |
|
1917 } |
|
1918 else |
|
1919 { |
|
1920 orderArray->InsertL( 0, |
|
1921 KFavouritesAdaptiveItemsFolderUid ); |
|
1922 } |
|
1923 } |
|
1924 } |
|
1925 else |
|
1926 if ( (ADAPTIVEBOOKMARKS) && |
|
1927 ( ApiProvider().Preferences().AdaptiveBookmarks() == |
|
1928 EWmlSettingsAdaptiveBookmarksOn ) ) |
|
1929 { |
|
1930 i = 0; |
|
1931 |
|
1932 while ( i < orderArray->Count() && |
|
1933 !( (*orderArray)[i] == |
|
1934 KFavouritesAdaptiveItemsFolderUid )) |
|
1935 { |
|
1936 i++; |
|
1937 } |
|
1938 |
|
1939 if ( i == orderArray->Count() != 0 ) |
|
1940 { |
|
1941 if ( (*orderArray)[0] == KFavouritesStartPageUid ) |
|
1942 { |
|
1943 orderArray->InsertL( 1, |
|
1944 KFavouritesAdaptiveItemsFolderUid ); |
|
1945 } |
|
1946 else |
|
1947 { |
|
1948 orderArray->InsertL( 0, |
|
1949 KFavouritesAdaptiveItemsFolderUid ); |
|
1950 } |
|
1951 } |
|
1952 } |
|
1953 |
|
1954 //add new items to the beginning of the list, if there is any |
|
1955 for ( TInt j = 0; j < aItems->Count(); j++ ) |
|
1956 { |
|
1957 i = 0; |
|
1958 while ( i < orderArray->Count() && |
|
1959 !( (*orderArray)[i] == aItems->At(j)->Uid() )) |
|
1960 { |
|
1961 i++; |
|
1962 } |
|
1963 |
|
1964 if ( i == orderArray->Count() && |
|
1965 !(aItems->At(j)->IsFactoryItem() ) && |
|
1966 !(aItems->At(j)->Uid() == |
|
1967 KFavouritesAdaptiveItemsFolderUid) && |
|
1968 !(aItems->At(j)->Uid() == KFavouritesStartPageUid) ) |
|
1969 { |
|
1970 Model().AddUidToLastPlaceL( aItems->At(j)->Uid(), |
|
1971 orderArray, iCurrentOrder ); |
|
1972 } |
|
1973 } |
|
1974 } |
|
1975 Model().ManualSortL(aFolder, iCurrentOrder, orderArray, aItems); |
|
1976 orderArray->Reset(); |
|
1977 } |
|
1978 } |
|
1979 |
|
1980 orderArray->Reset(); |
|
1981 |
|
1982 if ( aItems->Count() ) |
|
1983 { |
|
1984 for ( TInt i = 0; i < aItems->Count(); i++ ) |
|
1985 { |
|
1986 orderArray->AppendL( (*aItems)[i]->Uid() ); |
|
1987 } |
|
1988 iCurrentOrder->SetBookMarksOrderL( *orderArray ); |
|
1989 } |
|
1990 if ( iSaveBMOrder ) |
|
1991 { |
|
1992 iSaveBMOrder = EFalse; |
|
1993 Model().Database().SetData( aFolder, *iCurrentOrder ); |
|
1994 } |
|
1995 CleanupStack::PopAndDestroy( orderArray ); |
|
1996 } |
|
1997 return ETrue; |
|
1998 } |
|
1999 |
|
2000 // ---------------------------------------------------------------------------- |
|
2001 // CBrowserBookmarksView::GetItemsL |
|
2002 // ---------------------------------------------------------------------------- |
|
2003 // |
|
2004 CFavouritesItemList* CBrowserBookmarksView::GetItemsLC( TInt aFolder ) |
|
2005 { |
|
2006 PERFLOG_LOCAL_INIT |
|
2007 PERFLOG_STOPWATCH_START |
|
2008 CFavouritesItemList* items; |
|
2009 if ( iInAdaptiveBookmarksFolder ) |
|
2010 { |
|
2011 items= new (ELeave) CFavouritesItemList(); |
|
2012 CleanupStack::PushL(items);//1 |
|
2013 CDesCArrayFlat* aditems = new ( ELeave ) |
|
2014 CDesCArrayFlat( KBrowserDesCArrayGranularity ); |
|
2015 aditems->Reset(); |
|
2016 CleanupStack::PushL(aditems);//2 |
|
2017 |
|
2018 CDesCArrayFlat* adnames = new ( ELeave ) |
|
2019 CDesCArrayFlat( KBrowserDesCArrayGranularity ); |
|
2020 adnames->Reset(); |
|
2021 CleanupStack::PushL(adnames);//3 |
|
2022 |
|
2023 CFavouritesItem* adaptiveItem; |
|
2024 |
|
2025 if ( !iRecentUrlStore.GetData( *aditems, *adnames) ) |
|
2026 { |
|
2027 for (TInt i=0;i<aditems->MdcaCount(); i++) |
|
2028 { |
|
2029 adaptiveItem= CFavouritesItem::NewL(); |
|
2030 CleanupStack::PushL(adaptiveItem);//4 |
|
2031 adaptiveItem->SetUrlL( aditems->MdcaPoint(i) ); |
|
2032 adaptiveItem->SetNameL(adnames->MdcaPoint(i).Left(KFavouritesMaxName)); |
|
2033 adaptiveItem->SetType(CFavouritesItem::EItem); |
|
2034 adaptiveItem->SetParentFolder(KFavouritesAdaptiveItemsFolderUid); |
|
2035 items->AppendL(adaptiveItem); |
|
2036 CleanupStack::Pop(); // adaptiveItem |
|
2037 } |
|
2038 } |
|
2039 CleanupStack::PopAndDestroy( 2 );// aditems, adnames |
|
2040 } |
|
2041 else |
|
2042 { |
|
2043 items = new (ELeave) CFavouritesItemList(); |
|
2044 CleanupStack::PushL( items ); |
|
2045 Model().Database().GetAll( *items, aFolder ); |
|
2046 TInt aBMPosition = KAdaptiveBookmarksFirstPositionInBMView; // Adaptive BM folder is first if there is no startpage |
|
2047 if ( aFolder == KFavouritesRootUid ) |
|
2048 { |
|
2049 // Create Start Page item to be displayed in root folder (if exist). |
|
2050 // (Start Page does not really exist in the database.) |
|
2051 CFavouritesItem* startPage = CreateStartPageBookmarkL(); |
|
2052 if ( startPage ) |
|
2053 { |
|
2054 if (!iStartPagePresent) |
|
2055 { |
|
2056 iStartPagePresent = ETrue; |
|
2057 iSaveBMOrder = ETrue; |
|
2058 } |
|
2059 CleanupStack::PushL( startPage ); // ownersip is here. |
|
2060 items->InsertL( 0, startPage ); |
|
2061 CleanupStack::Pop(); // startPage: owner is the list now. |
|
2062 aBMPosition=KAdaptiveBookmarksSecondPositionInBMView; // Adaptive BM folder is second if there is a startpage item |
|
2063 } |
|
2064 else |
|
2065 { |
|
2066 if (iStartPagePresent) |
|
2067 { |
|
2068 iStartPagePresent = EFalse; |
|
2069 iSaveBMOrder = ETrue; |
|
2070 } |
|
2071 } |
|
2072 } |
|
2073 |
|
2074 if ( aFolder == KFavouritesRootUid ) |
|
2075 { |
|
2076 // Create Adaptive Items Folder item to be displayed in root folder (if exist). |
|
2077 // (Start Page does not really exist in the database.) |
|
2078 if ( ( ADAPTIVEBOOKMARKS ) && |
|
2079 ( ApiProvider().Preferences().AdaptiveBookmarks() == |
|
2080 EWmlSettingsAdaptiveBookmarksOn )) |
|
2081 { |
|
2082 CFavouritesItem* adaptiveItemsFolder = |
|
2083 Model().Database().CreateAdaptiveItemsFolderL(); |
|
2084 CleanupStack::PushL(adaptiveItemsFolder); |
|
2085 HBufC* folderName=StringLoader::LoadLC( |
|
2086 R_BROWSER_ADAPTIVE_BOOKMARKS_FOLDER); |
|
2087 adaptiveItemsFolder->SetNameL(*folderName); |
|
2088 |
|
2089 CleanupStack::PopAndDestroy();//folderName |
|
2090 items->InsertL( aBMPosition , adaptiveItemsFolder ); |
|
2091 CleanupStack::Pop(); // adaptiveItemsFolder: owner is the list now. |
|
2092 } |
|
2093 } |
|
2094 ManualBMSortL( aFolder, items ); |
|
2095 } |
|
2096 PERFLOG_STOP_WRITE("\t\t\t\t BM View GetItemsLC" ); |
|
2097 return items; |
|
2098 } |
|
2099 |
|
2100 // ---------------------------------------------------------------------------- |
|
2101 // CBrowserBookmarksView::RefreshL |
|
2102 // ---------------------------------------------------------------------------- |
|
2103 // |
|
2104 void CBrowserBookmarksView::RefreshL( TBool aDbErrorNote ) |
|
2105 { |
|
2106 // Same as base class method, except that refreshing Goto Pane is |
|
2107 // disallowed when fetching is in progress. |
|
2108 // Base class call is TRAP-ped to make sure that frozen state of the Goto |
|
2109 // Pane does not stay in due to a leave; but after removing the frozen |
|
2110 // state, we trow up the catched leave again (if any). |
|
2111 TBool fetching = ApiProvider().Fetching(); |
|
2112 |
|
2113 if ( (fetching && TheContainer() && TheContainer()->GotoPane() ) |
|
2114 || ( TheContainer() && TheContainer()->GotoPane() && TheContainer()->GotoPane()->IsEditing() )) |
|
2115 { |
|
2116 TheContainer()->GotoPane()->Freeze( ETrue ); |
|
2117 } |
|
2118 |
|
2119 TRAPD( err, CBrowserFavouritesView::RefreshL( aDbErrorNote ) ); |
|
2120 |
|
2121 |
|
2122 if ( TheContainer() && TheContainer()->GotoPane() ) |
|
2123 { |
|
2124 TheContainer()->GotoPane()->Freeze( EFalse ); |
|
2125 } |
|
2126 User::LeaveIfError( err ); |
|
2127 // Refresh (i.e. bookmark creation in an empty folder) may cause the need |
|
2128 // for toolbar button state to change. |
|
2129 UpdateToolbarButtonsState(); |
|
2130 } |
|
2131 |
|
2132 // ---------------------------------------------------------------------------- |
|
2133 // CBrowserBookmarksView::DoActivateL |
|
2134 // ---------------------------------------------------------------------------- |
|
2135 // |
|
2136 void CBrowserBookmarksView::DoActivateL ( |
|
2137 const TVwsViewId& aPrevViewId, |
|
2138 TUid aCustomMessageId, |
|
2139 const TDesC8& aCustomMessage |
|
2140 ) |
|
2141 { |
|
2142 PERFLOG_LOCAL_INIT |
|
2143 PERFLOG_STOPWATCH_START |
|
2144 LOG_ENTERFN("CBrowserBookmarksView::DoActivateL"); |
|
2145 LOG_WRITE_FORMAT(" aCustomMessageId: %d", aCustomMessageId); |
|
2146 |
|
2147 #ifdef BRDO_PERF_IMPROVEMENTS_ENABLED_FF |
|
2148 // Quick activation for first time only to show bookmarks view fast |
|
2149 if(!ApiProvider().StartedUp()) |
|
2150 { |
|
2151 CBrowserFavouritesView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage ); |
|
2152 if ( aCustomMessageId == KUidCustomMsgDownloadsList ) |
|
2153 { |
|
2154 iShowDownlods = ETrue; |
|
2155 // Show the downloads later since contentview has not initialized yet |
|
2156 } |
|
2157 |
|
2158 // complete remaining application launch process, aynchronously |
|
2159 // complete remaining init as soon as possible, otherwise it can be dangerous (crash) |
|
2160 // since UI code (views) are interdependent |
|
2161 iAsyncComplete = CIdle::NewL( CActive::EPriorityHigh ); |
|
2162 iAsyncComplete->Start( TCallBack( CompleteAppInitCallback, &iApiProvider ) ); |
|
2163 return; |
|
2164 } |
|
2165 #endif |
|
2166 |
|
2167 Toolbar()->HideItem( EWmlCmdAddBookmark, EFalse , ETrue); |
|
2168 |
|
2169 #ifndef BRDO_SINGLE_CLICK_ENABLED_FF |
|
2170 Toolbar()->HideItem( EWmlCmdDelete, EFalse , ETrue); |
|
2171 #else |
|
2172 Toolbar()->HideItem( EWmlCmdPreferences, EFalse , ETrue); |
|
2173 #endif |
|
2174 |
|
2175 if ( ApiProvider().Preferences().SearchFeature() ) |
|
2176 { |
|
2177 Toolbar()->HideItem( EWmlCmdGoToAddressAndSearch, EFalse, ETrue); |
|
2178 } |
|
2179 else |
|
2180 { |
|
2181 Toolbar()->HideItem( EWmlCmdGoToAddress, EFalse, ETrue); |
|
2182 } |
|
2183 |
|
2184 Cba()->MakeVisible( ETrue); |
|
2185 |
|
2186 StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL ); |
|
2187 StatusPane()->MakeVisible( ETrue ); |
|
2188 ApiProvider().Display().ClearMessageInfo(); |
|
2189 |
|
2190 iAdaptiveBookmarksFolderWasActive = EFalse; |
|
2191 |
|
2192 if ( iOpenAdaptiveBookmarksWhenActivated ) |
|
2193 { |
|
2194 iInAdaptiveBookmarksFolder = ETrue; |
|
2195 } |
|
2196 CBrowserFavouritesView::DoActivateL |
|
2197 ( aPrevViewId, aCustomMessageId, aCustomMessage ); |
|
2198 ApiProvider().BrCtlInterface().AddLoadEventObserverL( this ); |
|
2199 |
|
2200 if ( iPreferencesChanged ) |
|
2201 { |
|
2202 iPreferencesChanged=EFalse; |
|
2203 if ( iInAdaptiveBookmarksFolder ) |
|
2204 { |
|
2205 SetEmptyTextL(); |
|
2206 RefreshL(); |
|
2207 } |
|
2208 } |
|
2209 |
|
2210 if ( aCustomMessageId == KUidCustomMsgDownloadsList ) |
|
2211 { |
|
2212 LOG_WRITE(" KUidCustomMsgDownloadsList"); |
|
2213 // open the downloads list asynchronously not to block DoActivateL! |
|
2214 if ( iDownloadsListExecuter == 0 ) |
|
2215 { |
|
2216 iDownloadsListExecuter = new (ELeave) CAsyncDownloadsListExecuter( ApiProvider() ); |
|
2217 } |
|
2218 iDownloadsListExecuter->Start(); |
|
2219 } |
|
2220 if ( iOpenAdaptiveBookmarksWhenActivated ) |
|
2221 { |
|
2222 iInAdaptiveBookmarksFolder = ETrue; |
|
2223 SetEmptyTextL(); |
|
2224 RefreshL(); |
|
2225 iOpenAdaptiveBookmarksWhenActivated = EFalse; |
|
2226 } |
|
2227 |
|
2228 UpdateToolbarButtonsState(); |
|
2229 |
|
2230 PERFLOG_STOP_WRITE("BMView DoActivate") |
|
2231 // LOG_LEAVEFN("CBrowserBookmarksView::DoActivateL"); |
|
2232 } |
|
2233 |
|
2234 // ---------------------------------------------------------------------------- |
|
2235 // CBrowserBookmarksView::CompleteAppInitCallback |
|
2236 // ---------------------------------------------------------------------------- |
|
2237 // |
|
2238 TInt CBrowserBookmarksView::CompleteAppInitCallback( TAny* aProvider ) |
|
2239 { |
|
2240 MApiProvider *apiProvider = STATIC_CAST(MApiProvider*, aProvider); |
|
2241 TBool result = apiProvider->CompleteDelayedInit(); |
|
2242 return result; |
|
2243 } |
|
2244 |
|
2245 // ---------------------------------------------------------------------------- |
|
2246 // CBrowserBookmarksView::UpdateFavIcons |
|
2247 // ---------------------------------------------------------------------------- |
|
2248 // |
|
2249 void CBrowserBookmarksView::UpdateFavIconsL() |
|
2250 { |
|
2251 if ( Container() && Container()->Listbox() ) |
|
2252 Container()->Listbox()->UpdateFavIconsL(); |
|
2253 } |
|
2254 |
|
2255 |
|
2256 // ---------------------------------------------------------------------------- |
|
2257 // CBrowserBookmarksView::CheckForDownloads |
|
2258 // ---------------------------------------------------------------------------- |
|
2259 // |
|
2260 void CBrowserBookmarksView::CheckForDownloads() |
|
2261 { |
|
2262 if(iShowDownlods) |
|
2263 { |
|
2264 if ( iDownloadsListExecuter == 0 ) |
|
2265 iDownloadsListExecuter = new (ELeave) CAsyncDownloadsListExecuter( ApiProvider() ); |
|
2266 iDownloadsListExecuter->Start(); |
|
2267 } |
|
2268 } |
|
2269 // ---------------------------------------------------------------------------- |
|
2270 // CBrowserBookmarksView::DoDeactivate |
|
2271 // ---------------------------------------------------------------------------- |
|
2272 // |
|
2273 void CBrowserBookmarksView::DoDeactivate() |
|
2274 { |
|
2275 if ( !iSaveStateOnDeactivate ) |
|
2276 { |
|
2277 ExitAdaptiveBookmarks(); |
|
2278 } |
|
2279 if ( !ApiProvider().ExitInProgress() ) |
|
2280 { |
|
2281 if ( ApiProvider().StartedUp() ) |
|
2282 ApiProvider().BrCtlInterface().RemoveLoadEventObserver( this ); |
|
2283 } |
|
2284 CBrowserFavouritesView::DoDeactivate(); |
|
2285 iManualItemMovingGoingOn = EFalse; |
|
2286 // UnDim Toolbar buttons |
|
2287 DimToolbarButtons(EFalse); |
|
2288 } |
|
2289 |
|
2290 // ---------------------------------------------------------------------------- |
|
2291 // CBrowserBookmarksView::GotoUrlInGotoPaneL |
|
2292 // ---------------------------------------------------------------------------- |
|
2293 // |
|
2294 void CBrowserBookmarksView::GotoUrlInGotoPaneL() |
|
2295 { |
|
2296 LOG_ENTERFN("BookmarksView::GotoUrlInGotoPaneL"); |
|
2297 CBrowserBookmarksContainer* container = TheContainer(); |
|
2298 if ( container->GotoPane()->IsEditing() ) |
|
2299 { |
|
2300 // Dim Toolbar buttons |
|
2301 DimToolbarButtons(EFalse); |
|
2302 |
|
2303 delete iEnteredURL; |
|
2304 iEnteredURL = NULL; |
|
2305 BROWSER_LOG( ( _L("delete iEnteredUrl 4") ) ); |
|
2306 |
|
2307 iEnteredURL = container->GotoPane()->GetTextL(); |
|
2308 if ( iEnteredURL ) |
|
2309 { |
|
2310 iTrId = 0; |
|
2311 CEikEdwin* editor = STATIC_CAST(CEikEdwin*, container->GotoPane()->ComponentControl(1)); |
|
2312 iCursorPos = editor->CursorPos(); |
|
2313 |
|
2314 UpdateCbaL(); |
|
2315 // Cancel editing, but leave entered text in place. |
|
2316 container->GotoPane()->CancelEditingL(); |
|
2317 |
|
2318 ApiProvider().FetchL( iEnteredURL->Des(), CBrowserLoadObserver::ELoadUrlTypeOther ); |
|
2319 if ( !ApiProvider().Fetching() ) |
|
2320 { |
|
2321 container->SetGotoInactiveL(); |
|
2322 } |
|
2323 } |
|
2324 } |
|
2325 } |
|
2326 // ---------------------------------------------------------------------------- |
|
2327 // CBrowserBookmarksView::ExitAdaptiveBookmarks() |
|
2328 // ---------------------------------------------------------------------------- |
|
2329 // |
|
2330 void CBrowserBookmarksView::ExitAdaptiveBookmarks() |
|
2331 { |
|
2332 if (iInAdaptiveBookmarksFolder) |
|
2333 { |
|
2334 iAdaptiveBookmarksFolderWasActive = ETrue; |
|
2335 iInAdaptiveBookmarksFolder=EFalse; |
|
2336 delete iDomainFolderName; |
|
2337 iDomainFolderName=NULL; |
|
2338 } |
|
2339 } |
|
2340 |
|
2341 // ---------------------------------------------------------------------------- |
|
2342 // CBrowserBookmarksView::DimToolbarButtons() |
|
2343 // ---------------------------------------------------------------------------- |
|
2344 // |
|
2345 void CBrowserBookmarksView::DimToolbarButtons(TBool aDimButtons) |
|
2346 { |
|
2347 Toolbar()->SetItemDimmed( EWmlCmdAddBookmark, aDimButtons , ETrue ); |
|
2348 Toolbar()->SetItemDimmed( EWmlCmdGoToAddress, aDimButtons , ETrue ); |
|
2349 Toolbar()->SetItemDimmed( EWmlCmdGoToAddressAndSearch, aDimButtons , ETrue ); |
|
2350 #ifndef BRDO_SINGLE_CLICK_ENABLED_FF |
|
2351 Toolbar()->SetItemDimmed( EWmlCmdDelete, aDimButtons , ETrue ); |
|
2352 #else |
|
2353 Toolbar()->SetItemDimmed( EWmlCmdPreferences, aDimButtons , ETrue ); |
|
2354 #endif |
|
2355 if (!aDimButtons) |
|
2356 { |
|
2357 // when undimming buttons we may not want them all back on |
|
2358 UpdateToolbarButtonsState(); |
|
2359 } |
|
2360 Toolbar()->DrawNow(); |
|
2361 } |
|
2362 |
|
2363 // ---------------------------------------------------------------------------- |
|
2364 // CBrowserBookmarksView::ActivateCurrentBookmarkL |
|
2365 // ---------------------------------------------------------------------------- |
|
2366 // |
|
2367 void CBrowserBookmarksView::ActivateCurrentBookmarkL() |
|
2368 { |
|
2369 if ( Container() && Container()->Listbox() ) |
|
2370 { |
|
2371 const CFavouritesItem* item = Container()->Listbox()->CurrentItem(); |
|
2372 if ( item && item->IsItem() ) |
|
2373 { |
|
2374 ApiProvider().FetchBookmarkL( *item ); |
|
2375 } |
|
2376 } |
|
2377 } |
|
2378 |
|
2379 // ---------------------------------------------------------------------------- |
|
2380 // CBrowserBookmarksView::AddNewBookmarkL |
|
2381 // ---------------------------------------------------------------------------- |
|
2382 // |
|
2383 void CBrowserBookmarksView::AddNewBookmarkL() |
|
2384 { |
|
2385 // Make an item and fill it with default values. |
|
2386 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
2387 item->SetType( CFavouritesItem::EItem ); |
|
2388 item->SetParentFolder( CurrentFolder() ); |
|
2389 item->SetUrlL( KHttpString ); |
|
2390 Model().SetNameToDefaultL( *item ); |
|
2391 TInt err = Model().MakeUniqueNameL( *item ); |
|
2392 if ( !err ) |
|
2393 { |
|
2394 // to prevent faded statuspane at the begining of dialog activation |
|
2395 CEikStatusPane* sp = STATIC_CAST( CAknAppUi*, |
|
2396 CEikonEnv::Static()->EikAppUi() ) |
|
2397 ->StatusPane(); |
|
2398 sp->DrawNow(); |
|
2399 |
|
2400 // Dim Toolbar buttons |
|
2401 DimToolbarButtons(ETrue); |
|
2402 |
|
2403 // We have the item with a default unique name. Let the user edit it. |
|
2404 CBrowserBookmarkEditDialog* dialog = |
|
2405 CBrowserBookmarkEditDialog::NewL |
|
2406 ( |
|
2407 *item, |
|
2408 Model(), |
|
2409 //ApiProvider().CommsModel() |
|
2410 ApiProvider() |
|
2411 ); |
|
2412 dialog->ExecuteLD( R_BROWSER_BOOKMARKS_DIALOG_EDIT ); |
|
2413 |
|
2414 // Un-Dim Toolbar buttons |
|
2415 DimToolbarButtons(EFalse); |
|
2416 |
|
2417 // If the bookmark was added to the database, highlight it. |
|
2418 // Unlike in AddNewFolderL, adding the item to the database |
|
2419 // and setting highlight uid (next line of code) runs in the RunL |
|
2420 // method of different active objects. So the database notification |
|
2421 // may have came in or may not by now. |
|
2422 // This way of doing the highlight (setting a preferred and calling |
|
2423 // HighlightPreferred works in both cases. |
|
2424 iPreferredHighlightUid = item->Uid(); |
|
2425 // If not added, iPreferredHighlightUid is now KFavouritesNullUid, |
|
2426 // so the following does nothing. |
|
2427 if ( iPreferredHighlightUid != KFavouritesNullUid ) |
|
2428 { |
|
2429 // Highlight newly added item. |
|
2430 HighlightPreferredL(); |
|
2431 } |
|
2432 } |
|
2433 AddUidToLastPlaceToCurrentListL( item->Uid() ); |
|
2434 iRefresh = EFalse; |
|
2435 Model().Database().SetData( CurrentFolder() , *iCurrentOrder ); |
|
2436 CleanupStack::PopAndDestroy(); // item |
|
2437 Container()->Listbox()->ClearSelection(); |
|
2438 } |
|
2439 |
|
2440 |
|
2441 // ---------------------------------------------------------------------------- |
|
2442 // CBrowserBookmarksView::AddUidToLastPlaceToCurrentListL |
|
2443 // ---------------------------------------------------------------------------- |
|
2444 // |
|
2445 void CBrowserBookmarksView::AddUidToLastPlaceToCurrentListL( TInt aUid ) |
|
2446 { |
|
2447 if ( iCurrentOrder ) |
|
2448 { |
|
2449 CArrayFixFlat<TInt>* orderArray = new (ELeave) CArrayFixFlat<TInt>(KGranularityHigh); |
|
2450 CleanupStack::PushL( orderArray ); |
|
2451 |
|
2452 if (iCurrentOrder->GetBookMarksOrder().Count()) |
|
2453 { |
|
2454 orderArray->AppendL( &( iCurrentOrder->GetBookMarksOrder()[0] ), |
|
2455 iCurrentOrder->GetBookMarksOrder().Count()); |
|
2456 } |
|
2457 |
|
2458 Model().AddUidToLastPlaceL(aUid, orderArray, iCurrentOrder); |
|
2459 |
|
2460 iCurrentOrder->SetBookMarksOrderL( *orderArray ); |
|
2461 CleanupStack::PopAndDestroy( orderArray ); |
|
2462 } |
|
2463 } |
|
2464 |
|
2465 // ---------------------------------------------------------------------------- |
|
2466 // CBrowserBookmarks::EditCurrentBookmarkL |
|
2467 // ---------------------------------------------------------------------------- |
|
2468 // |
|
2469 void CBrowserBookmarksView::EditCurrentBookmarkL() |
|
2470 { |
|
2471 if ( Container() && Container()->Listbox() ) |
|
2472 { |
|
2473 const CFavouritesItem* listboxItem = |
|
2474 Container()->Listbox()->CurrentItem(); |
|
2475 if ( listboxItem && listboxItem->IsItem() ) |
|
2476 { |
|
2477 // to prevent faded statuspane at the begining of dialog activation |
|
2478 CEikStatusPane* sp = STATIC_CAST( CAknAppUi*, |
|
2479 CEikonEnv::Static()->EikAppUi() ) |
|
2480 ->StatusPane(); |
|
2481 sp->DrawNow(); |
|
2482 |
|
2483 // Dim Toolbar buttons |
|
2484 DimToolbarButtons(ETrue); |
|
2485 |
|
2486 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
2487 *item = *listboxItem; |
|
2488 CBrowserBookmarkEditDialog* dialog = |
|
2489 CBrowserBookmarkEditDialog::NewL |
|
2490 ( |
|
2491 *item, |
|
2492 Model(), |
|
2493 ApiProvider(), |
|
2494 listboxItem->Uid() |
|
2495 ); |
|
2496 dialog->ExecuteLD( R_BROWSER_BOOKMARKS_DIALOG_EDIT ); |
|
2497 CleanupStack::PopAndDestroy(); // item |
|
2498 |
|
2499 // unDim Toolbar buttons |
|
2500 DimToolbarButtons(EFalse); |
|
2501 |
|
2502 iPreferredHighlightUid = item->Uid(); |
|
2503 |
|
2504 // Force a refresh of database changes. |
|
2505 iRefresh = ETrue; |
|
2506 } |
|
2507 } |
|
2508 } |
|
2509 |
|
2510 // ---------------------------------------------------------------------------- |
|
2511 // CBrowserBookmarksView::SendBookmarksL |
|
2512 // ---------------------------------------------------------------------------- |
|
2513 // |
|
2514 void CBrowserBookmarksView::SendBookmarksL( ) |
|
2515 { |
|
2516 CArrayPtr<const CFavouritesItem>* items = |
|
2517 Container()->Listbox()->SelectedItemsLC(); |
|
2518 |
|
2519 MBmOTABinSender& sender = ApiProvider().BmOTABinSenderL(); |
|
2520 |
|
2521 sender.ResetAndDestroy(); |
|
2522 |
|
2523 TBool result( ETrue ); |
|
2524 TInt index( 0 ); |
|
2525 TInt count( items->Count() ); |
|
2526 |
|
2527 #ifndef _BOOKMARK_SENT_ASCII |
|
2528 for ( index = 0; index < count; ++index ) |
|
2529 { |
|
2530 if ( ( *items )[ index ]->Url().Length() > KMaxUrlLenghtInOTA ) |
|
2531 { |
|
2532 #pragma message ( __FILE__ ": TODO: Length of bookmark address cannot exceed 255bytes!") |
|
2533 result = EFalse; |
|
2534 } |
|
2535 } |
|
2536 #endif // _BOOKMARK_SENT_ASCII |
|
2537 |
|
2538 if ( result ) |
|
2539 { |
|
2540 for ( index = 0; index < count; ++index ) |
|
2541 { |
|
2542 sender.AppendL( ( *items )[ index ]->Url(), |
|
2543 ( *items )[ index ]->Name() ); |
|
2544 } |
|
2545 } |
|
2546 |
|
2547 // to save memory |
|
2548 CleanupStack::PopAndDestroy(); // items; |
|
2549 |
|
2550 if ( result ) |
|
2551 { |
|
2552 sender.SendAddressL( ); |
|
2553 } |
|
2554 |
|
2555 Container()->Listbox()->SetCurrentItemIndexAndDraw( Container()->Listbox()->CurrentItemIndex()); |
|
2556 } |
|
2557 |
|
2558 |
|
2559 // ---------------------------------------------------------------------------- |
|
2560 // CBrowserBookmarksView::TheContainer |
|
2561 // ---------------------------------------------------------------------------- |
|
2562 // |
|
2563 CBrowserBookmarksContainer* CBrowserBookmarksView::TheContainer() |
|
2564 { |
|
2565 return STATIC_CAST( CBrowserBookmarksContainer*, Container() ); |
|
2566 } |
|
2567 |
|
2568 // ---------------------------------------------------------------------------- |
|
2569 // CBrowserBookmarksView::ApChangedL |
|
2570 // ---------------------------------------------------------------------------- |
|
2571 // |
|
2572 void CBrowserBookmarksView::ApChangedL( TUint32 aNewAPId ) |
|
2573 { |
|
2574 if ( aNewAPId != iStartPageApUid ) |
|
2575 { |
|
2576 // New AP has been taken into use. Set Start Page to that. |
|
2577 iStartPageApUid = aNewAPId; |
|
2578 // Redraw view. Note that this does nothing if view is not activated. |
|
2579 RefreshL( EFalse ); |
|
2580 } |
|
2581 } |
|
2582 |
|
2583 // ---------------------------------------------------------------------------- |
|
2584 // CBrowserBookmarksView::HandlePreferencesChangeL |
|
2585 // ---------------------------------------------------------------------------- |
|
2586 // |
|
2587 void CBrowserBookmarksView::HandlePreferencesChangeL( |
|
2588 const TPreferencesEvent /*aEvent*/, |
|
2589 TPreferencesValues& /*aValues*/, |
|
2590 TBrCtlDefs::TBrCtlSettings /*aSettingType*/ ) |
|
2591 { |
|
2592 // adaptive bookmarks setting changed |
|
2593 if ( iAdaptiveBookmarksCurrentSetting != |
|
2594 ApiProvider().Preferences().AdaptiveBookmarks() ) |
|
2595 { |
|
2596 iAdaptiveBookmarksCurrentSetting = |
|
2597 ApiProvider().Preferences().AdaptiveBookmarks(); |
|
2598 |
|
2599 if ( iAdaptiveBookmarksCurrentSetting != |
|
2600 EWmlSettingsAdaptiveBookmarksOn ) |
|
2601 { |
|
2602 if ( iPreferredHighlightUid == KFavouritesAdaptiveItemsFolderUid ) |
|
2603 { |
|
2604 Container()->Listbox()->View()->SetCurrentItemIndex( 0 ); |
|
2605 } |
|
2606 |
|
2607 ExitAdaptiveBookmarks(); |
|
2608 |
|
2609 if ( iAdaptiveBookmarksCurrentSetting == |
|
2610 EWmlSettingsAdaptiveBookmarksOff ) |
|
2611 { |
|
2612 if ( TBrowserDialogs::ConfirmQueryYesNoL( |
|
2613 R_BROWSER_ADAPTIVE_BOOKMARKS_DELETE_ALL_ADAPTIVE_BOOKMARKS ) ) |
|
2614 { |
|
2615 iRecentUrlStore.ClearData(); |
|
2616 } |
|
2617 } |
|
2618 } |
|
2619 else |
|
2620 { |
|
2621 iInsertAdaptiveBookmarksFolder = ETrue; |
|
2622 iSaveBMOrder = ETrue; |
|
2623 } |
|
2624 } |
|
2625 |
|
2626 TUint32 defaultAp = ApiProvider().Preferences().DefaultAccessPoint(); |
|
2627 |
|
2628 if ( defaultAp != iCurrentDefaultAp ) |
|
2629 { |
|
2630 // Default AP changed. Set Start Page bookmark to that. |
|
2631 iCurrentDefaultAp = iStartPageApUid = defaultAp; |
|
2632 // Redraw view. Note that this does nothing if view is not activated. |
|
2633 RefreshL( EFalse ); |
|
2634 } |
|
2635 |
|
2636 iPreferencesChanged=ETrue; |
|
2637 } |
|
2638 |
|
2639 // ---------------------------------------------------------------------------- |
|
2640 // CBrowserBookmarksView::CreateStartPageBookmarkL |
|
2641 // ---------------------------------------------------------------------------- |
|
2642 // |
|
2643 CFavouritesItem* CBrowserBookmarksView::CreateStartPageBookmarkL() |
|
2644 { |
|
2645 LOG_ENTERFN("CBrowserBookmarksView::CreateStartPageBookmarkL"); |
|
2646 // no HomePage if Type is Bookmarks |
|
2647 // or 'Always ask' feature is selected |
|
2648 TWmlSettingsHomePage pgtype = ApiProvider().Preferences().HomePageType(); |
|
2649 TBool accessPointSelectionMode( |
|
2650 (ApiProvider().Preferences().AccessPointSelectionMode() == EAlwaysAsk) && |
|
2651 ( EWmlSettingsHomePageAccessPoint == pgtype ) ); |
|
2652 LOG_WRITE_FORMAT(" pgType: %d", pgtype ); |
|
2653 LOG_WRITE_FORMAT(" selection mode: %d", accessPointSelectionMode ); |
|
2654 if ( accessPointSelectionMode || (pgtype == EWmlSettingsHomePageBookmarks) ) |
|
2655 { |
|
2656 return NULL; |
|
2657 } |
|
2658 |
|
2659 CFavouritesItem* startPage = NULL; |
|
2660 TUint defaultAp = ApiProvider().Preferences().DefaultAccessPoint(); |
|
2661 LOG_WRITE_FORMAT(" defaultAp: %d", defaultAp ); |
|
2662 if ( defaultAp != KWmlNoDefaultAccessPoint ) // There is an access point defined |
|
2663 { |
|
2664 // Get pointer to Start Page AP (or NULL if no such); |
|
2665 /* |
|
2666 Modified by MOG |
|
2667 --------------------- Performance Changes ---------------------- |
|
2668 remove dependency from CommsModel becasue the cached list may not be pre |
|
2669 CApListItem* apItem = |
|
2670 ApiProvider().CommsModel().AccessPoints()->ItemForUid( defaultAp ); |
|
2671 ---------------------- Performance Changes ---------------------- |
|
2672 */ |
|
2673 CApAccessPointItem* apItem = iApiProvider.Preferences().AllPreferencesL().iDefaultAPDetails; |
|
2674 if ( apItem ) |
|
2675 { |
|
2676 const HBufC* defaultHP = apItem->ReadConstLongTextL( EApWapStartPage ); |
|
2677 if ( defaultHP->Length() ) |
|
2678 { |
|
2679 // Have AP and the AP has Start Page address. Hurray. |
|
2680 startPage = Model().Database().CreateStartPageItemL(); |
|
2681 CleanupStack::PushL( startPage ); |
|
2682 TBuf<KFavouritesMaxName> name; |
|
2683 apItem->ReadTextL(EApWapAccessPointName, name); |
|
2684 startPage->SetNameL( name ); |
|
2685 startPage->SetUrlL( *defaultHP ); |
|
2686 TFavouritesWapAp ap; |
|
2687 ap.SetApId( defaultAp ); |
|
2688 startPage->SetWapAp( ap ); |
|
2689 CleanupStack::Pop(); // startPage: owner is the caller. |
|
2690 } |
|
2691 } |
|
2692 } |
|
2693 //LOG_LEAVEFN("CBrowserBookmarksView::CreateStartPageBookmarkL"); |
|
2694 return startPage; |
|
2695 } |
|
2696 |
|
2697 // ---------------------------------------------------------------------------- |
|
2698 // CBrowserBookmarksView::OfferKeyEventL |
|
2699 // ---------------------------------------------------------------------------- |
|
2700 // |
|
2701 TKeyResponse CBrowserBookmarksView::OfferKeyEventL( |
|
2702 const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
2703 { |
|
2704 // This method is called back from the container, to process the keypresses |
|
2705 // that cannot be handled by the container. Those are (currently) the |
|
2706 // left/right arrow keypresses, since the container does not know anything |
|
2707 // about what folder is open, which knowledge is required to process |
|
2708 // arrow presses. So we do that here. |
|
2709 // Any other key processing is still in the container. |
|
2710 TKeyResponse result = EKeyWasNotConsumed; |
|
2711 switch ( aKeyEvent.iCode ) |
|
2712 { |
|
2713 |
|
2714 case EKeyLeftArrow: // West |
|
2715 { |
|
2716 if ( ( CurrentFolder() != KFavouritesRootUid ) || ( iInAdaptiveBookmarksFolder ) ) |
|
2717 { |
|
2718 // We are in some folder. Move between subfolders in the leftwards direction. |
|
2719 if ( !ApiProvider().IsEmbeddedModeOn() && !iManualItemMovingGoingOn ) |
|
2720 { |
|
2721 OpenNextFolderL( /*aForward=*/EFalse ); |
|
2722 } |
|
2723 result = EKeyWasConsumed; |
|
2724 } |
|
2725 break; |
|
2726 } |
|
2727 |
|
2728 case EKeyRightArrow: // East |
|
2729 { |
|
2730 if ( ( CurrentFolder() != KFavouritesRootUid ) || ( iInAdaptiveBookmarksFolder ) ) |
|
2731 { |
|
2732 // We are in some folder. Move between subfolders in the rightwards direction. |
|
2733 if ( !ApiProvider().IsEmbeddedModeOn() && !iManualItemMovingGoingOn ) |
|
2734 { |
|
2735 OpenNextFolderL( /*aForward=*/ETrue ); |
|
2736 } |
|
2737 result = EKeyWasConsumed; |
|
2738 } |
|
2739 break; |
|
2740 } |
|
2741 |
|
2742 case EKeyRightUpArrow: // Northeast |
|
2743 case EStdKeyDevice11: // : Extra KeyEvent supports diagonal event simulator wedge |
|
2744 case EKeyRightDownArrow: // Southeast |
|
2745 case EStdKeyDevice12: // : Extra KeyEvent supports diagonal event simulator wedge |
|
2746 case EKeyLeftDownArrow: // Southwest |
|
2747 case EStdKeyDevice13: // : Extra KeyEvent supports diagonal event simulator wedge |
|
2748 case EKeyLeftUpArrow: // Northwest |
|
2749 case EStdKeyDevice10: // : Extra KeyEvent supports diagonal event simulator wedge |
|
2750 { // Here, "eat" all of the diagonals so they have no effect |
|
2751 result = EKeyWasConsumed; |
|
2752 break; |
|
2753 } |
|
2754 |
|
2755 case EKeyBackspace: |
|
2756 case EKeyDelete: |
|
2757 { |
|
2758 TBrowserFavouritesSelectionState state = |
|
2759 iContainer->Listbox()->SelectionStateL(); |
|
2760 const CFavouritesItem* item = Container()->Listbox()->CurrentItem(); |
|
2761 |
|
2762 if ( ( state.AnyDeletable() ) && |
|
2763 // We can't delete adaptive bookmarks folder or seamless folders' |
|
2764 ( item ) && |
|
2765 ( item->Uid() != KFavouritesAdaptiveItemsFolderUid ) && |
|
2766 ( item->ContextId() == NULL ) |
|
2767 ) |
|
2768 { |
|
2769 // Clear key deletes the selection (or highlighted items). |
|
2770 if (iInAdaptiveBookmarksFolder) |
|
2771 { |
|
2772 HandleCommandL(EWmlCmdDelete); |
|
2773 result = EKeyWasConsumed; |
|
2774 } |
|
2775 else if (iManualItemMovingGoingOn) |
|
2776 // Manual Move in progress -- disable delete key |
|
2777 { |
|
2778 result = EKeyWasConsumed; |
|
2779 } |
|
2780 else |
|
2781 { |
|
2782 result =CBrowserFavouritesView::OfferKeyEventL(aKeyEvent,aType); |
|
2783 } |
|
2784 |
|
2785 } |
|
2786 break; |
|
2787 } |
|
2788 |
|
2789 case EKeyOK: |
|
2790 // OK key is handled through MSK handling |
|
2791 result = EKeyWasConsumed; |
|
2792 break; |
|
2793 |
|
2794 case EKeyEnter: |
|
2795 { |
|
2796 if ( iManualItemMovingGoingOn ) |
|
2797 { |
|
2798 MoveItemsL(); |
|
2799 result = EKeyWasConsumed; |
|
2800 } |
|
2801 else |
|
2802 { |
|
2803 result = CBrowserFavouritesView::OfferKeyEventL(aKeyEvent,aType); |
|
2804 } |
|
2805 break; |
|
2806 } |
|
2807 |
|
2808 default: |
|
2809 { |
|
2810 result =CBrowserFavouritesView::OfferKeyEventL(aKeyEvent,aType); |
|
2811 break; |
|
2812 } |
|
2813 } |
|
2814 |
|
2815 return result; |
|
2816 } |
|
2817 |
|
2818 // ---------------------------------------------------------------------------- |
|
2819 // CBrowserBookmarksView::OpenNextFolderL |
|
2820 // ---------------------------------------------------------------------------- |
|
2821 // |
|
2822 void CBrowserBookmarksView::OpenNextFolderL( TBool aForward ) |
|
2823 { |
|
2824 if ( !Model().BeginL( EFalse, ETrue ) ) |
|
2825 { |
|
2826 TInt nextFolder; |
|
2827 if ( iInAdaptiveBookmarksFolder ) |
|
2828 { |
|
2829 // If in domain then forget about it |
|
2830 if (iDomainFolderName) |
|
2831 { |
|
2832 delete iDomainFolderName; |
|
2833 iDomainFolderName = NULL; |
|
2834 } |
|
2835 |
|
2836 nextFolder = Model().NextFolderL( KFavouritesAdaptiveItemsFolderUid, |
|
2837 aForward ); |
|
2838 if ( nextFolder != KFavouritesNullUid ) |
|
2839 { |
|
2840 iInAdaptiveBookmarksFolder = EFalse; |
|
2841 } |
|
2842 } |
|
2843 else |
|
2844 { |
|
2845 nextFolder = Model().NextFolderL( CurrentFolder(), aForward ); |
|
2846 } |
|
2847 |
|
2848 if ( nextFolder != KFavouritesNullUid ) |
|
2849 { |
|
2850 if ( nextFolder != KFavouritesAdaptiveItemsFolderUid ) |
|
2851 { |
|
2852 SetEmptyTextL(); |
|
2853 OpenFolderL( nextFolder ); |
|
2854 } |
|
2855 } |
|
2856 Model().CommitL(); |
|
2857 if ( nextFolder == KFavouritesAdaptiveItemsFolderUid ) |
|
2858 { |
|
2859 iInAdaptiveBookmarksFolder=ETrue; |
|
2860 SetEmptyTextL(); |
|
2861 SetRootFolderForAdaptiveBookmarks(); |
|
2862 SetEmptyTextL(); |
|
2863 RefreshL(); |
|
2864 } |
|
2865 } |
|
2866 // Changing folder may require change in toolbar button state |
|
2867 UpdateToolbarButtonsState(); |
|
2868 } |
|
2869 |
|
2870 // ---------------------------------------------------------------------------- |
|
2871 // CBrowserBookmarksView::UpdateNaviPaneL |
|
2872 // ---------------------------------------------------------------------------- |
|
2873 // |
|
2874 void CBrowserBookmarksView::UpdateNaviPaneL() |
|
2875 { |
|
2876 if (iInAdaptiveBookmarksFolder) |
|
2877 { |
|
2878 // In other folder, show "1/4" style text. |
|
2879 TInt folderIndex; |
|
2880 TInt folderCount; |
|
2881 TInt err; |
|
2882 err = Model().FolderInfoL( KFavouritesAdaptiveItemsFolderUid, |
|
2883 folderCount, folderIndex ); |
|
2884 if ( !err ) |
|
2885 { |
|
2886 TheContainer()->ShowFolderNaviPaneL( folderIndex, folderCount ); |
|
2887 } |
|
2888 } |
|
2889 else |
|
2890 { |
|
2891 CBrowserFavouritesView::UpdateNaviPaneL(); |
|
2892 } |
|
2893 } |
|
2894 |
|
2895 // --------------------------------------------------------------------------- |
|
2896 // CBrowserBookmarksView::HandleBrowserLoadEventL |
|
2897 // --------------------------------------------------------------------------- |
|
2898 // |
|
2899 void CBrowserBookmarksView::HandleBrowserLoadEventL( |
|
2900 TBrCtlDefs::TBrCtlLoadEvent aLoadEvent, |
|
2901 TUint /* aSize */, |
|
2902 TUint16 aTransactionId ) |
|
2903 { |
|
2904 LOG_ENTERFN("BookmarksView::HandleBrowserLoadEventL"); |
|
2905 // only GotoPane is interested in LoadEvents! |
|
2906 if ( Container() ) |
|
2907 { |
|
2908 if ( aLoadEvent != TBrCtlDefs::EEventThumbnailAvailable) |
|
2909 { |
|
2910 // If in bookmarks view, a background page load is in |
|
2911 // progress, just update the soft keys when page load is finished. |
|
2912 // (ie. RSK would be "Stop" while page loading but change to "Exit" |
|
2913 // when page load finished) |
|
2914 if ( aLoadEvent == TBrCtlDefs::EEventLoadFinished ) |
|
2915 { |
|
2916 UpdateCbaL(); |
|
2917 } |
|
2918 } |
|
2919 // save transaction id |
|
2920 if ( aLoadEvent == TBrCtlDefs::EEventUrlLoadingStart && iTrId == 0 ) |
|
2921 { |
|
2922 iTrId = aTransactionId; |
|
2923 } |
|
2924 // first content chunk arrived |
|
2925 else if ( aLoadEvent == TBrCtlDefs::EEventNewUrlContentArrived && |
|
2926 iTrId == aTransactionId ) |
|
2927 { |
|
2928 if ( iEnteredURL ) |
|
2929 { |
|
2930 delete iEnteredURL; |
|
2931 iEnteredURL = NULL; |
|
2932 BROWSER_LOG( ( _L("delete iEnteredUrl 5") ) ); |
|
2933 } |
|
2934 iCursorPos = -1; |
|
2935 } |
|
2936 } |
|
2937 } |
|
2938 |
|
2939 |
|
2940 // --------------------------------------------------------------------------- |
|
2941 // CBrowserBookmarksView::ClearAdaptiveBookmarksL |
|
2942 // --------------------------------------------------------------------------- |
|
2943 // |
|
2944 void CBrowserBookmarksView::ClearAdaptiveBookmarksL() |
|
2945 { |
|
2946 iRecentUrlStore.ClearData(); |
|
2947 Container()->Listbox()->View()->ClearSelection(); |
|
2948 RefreshL(); |
|
2949 } |
|
2950 |
|
2951 // --------------------------------------------------------------------------- |
|
2952 // CBrowserBookmarksView::UpdateToolbarButtonsState |
|
2953 // --------------------------------------------------------------------------- |
|
2954 // |
|
2955 void CBrowserBookmarksView::UpdateToolbarButtonsState() |
|
2956 { |
|
2957 if ( Container() && Container()->Listbox() ) |
|
2958 { |
|
2959 const CFavouritesItem* item = Container()->Listbox()->CurrentItem(); |
|
2960 |
|
2961 // Button: EWmlCmdDelete |
|
2962 // Default case: un-dim the delete Button |
|
2963 // Case: Not an item so dim delete button |
|
2964 // Special Case: dim button for adaptive folder and |
|
2965 // seamless links |
|
2966 TBrowserFavouritesSelectionState state = iContainer->Listbox()->SelectionStateL(); |
|
2967 |
|
2968 TBool needToDimDeleteBtn = !item |
|
2969 || ( item->Uid() == KFavouritesAdaptiveItemsFolderUid ) |
|
2970 || ( item->ContextId() != NULL ) |
|
2971 || (!state.AnyDeletable()); |
|
2972 |
|
2973 Toolbar()->SetItemDimmed( EWmlCmdDelete, needToDimDeleteBtn, ETrue ); |
|
2974 //set EWmlCmdAddBookmark dim in RecentlyVisitedUrl Folder |
|
2975 Toolbar()->SetItemDimmed( EWmlCmdAddBookmark, iInAdaptiveBookmarksFolder, ETrue); |
|
2976 if(iManualItemMovingGoingOn) |
|
2977 { |
|
2978 DimToolbarButtons(ETrue); |
|
2979 } |
|
2980 } |
|
2981 } |
|
2982 |
|
2983 void CBrowserBookmarksView::HandleForegroundEventL( TBool aForeground ) |
|
2984 { |
|
2985 // make sure we call base class function before proceeding |
|
2986 CBrowserFavouritesView::HandleForegroundEventL(aForeground); |
|
2987 if ( aForeground ) |
|
2988 { |
|
2989 if ( TheContainer()->GotoPaneActive() && TheContainer()->GotoPane()->PopupList()->IsPoppedUp() ) |
|
2990 { |
|
2991 // The pop up messes the screen when changing layouts |
|
2992 // So make sure to redraw the pane while coming to foreground |
|
2993 TheContainer()->GotoPane()->PopupList()->HandleResourceChange(KEikDynamicLayoutVariantSwitch); |
|
2994 } |
|
2995 } |
|
2996 } |
|
2997 // End of File |