browserui/browser/FavouritesSrc/BrowserBookmarksView.cpp
changeset 10 57d5b8e231c4
parent 0 84ad3b177aa3
child 18 4530440261a8
equal deleted inserted replaced
0:84ad3b177aa3 10:57d5b8e231c4
   117         }
   117         }
   118     CBrowserBookmarksContainer* container = TheContainer();
   118     CBrowserBookmarksContainer* container = TheContainer();
   119     if ( container )
   119     if ( container )
   120         {
   120         {
   121         container->GotoPane()->SetGPObserver( NULL );
   121         container->GotoPane()->SetGPObserver( NULL );
       
   122         if( ApiProvider().Preferences().SearchFeature() )
       
   123             container->SearchPane()->SetGPObserver( NULL );
   122         }
   124         }
   123     delete iDomainFolderName;
   125     delete iDomainFolderName;
   124     delete iItemsToMove;
   126     delete iItemsToMove;
   125     delete iCurrentOrder;
   127     delete iCurrentOrder;
   126     delete iEnteredURL;
   128     delete iEnteredURL;
   246             {
   248             {
   247             if ( iManualItemMovingGoingOn )
   249             if ( iManualItemMovingGoingOn )
   248                 {
   250                 {
   249                 ProcessCommandL(EWmlCmdMoveCancel);
   251                 ProcessCommandL(EWmlCmdMoveCancel);
   250                 }
   252                 }
   251             else if ( TheContainer() && TheContainer()->GotoPane()->IsEditing() )
   253 			else if( TheContainer() 
       
   254 			        && ( TheContainer()->GotoPane()->IsEditing() 
       
   255 			        || TheContainer()->SearchPane()->IsEditing()))
   252                 {
   256                 {
   253                 ProcessCommandL(EWmlCmdGotoPaneCancel);
   257                 ProcessCommandL(EWmlCmdGotoPaneCancel);
   254                 }
   258                 }
   255             break;
   259             break;
   256             }
   260             }
   312         switch ( aCommand )
   316         switch ( aCommand )
   313         {
   317         {
   314         // CBA commands.
   318         // CBA commands.
   315         case EWmlCmdGotoPaneGoTo:
   319         case EWmlCmdGotoPaneGoTo:
   316             {
   320             {
   317             if (TheContainer()->GotoPane()->Editor()->TextLength()!= 0)
   321             if( TheContainer()->GotoPaneActive() )
   318                 {
   322                 {
   319                 // Cancel editing and sets Goto Pane text back.
   323                 if (TheContainer()->GotoPane()->Editor()->TextLength()!= 0)
   320                 if (TheContainer()->GotoPane()->PopupList() != NULL)
   324                     {
   321                     {
   325                     // Cancel editing and sets Goto Pane text back.
   322                     TheContainer()->GotoPane()->PopupList()->SetDirectoryModeL( ETrue );
   326                     if (TheContainer()->GotoPane()->PopupList() != NULL)
   323                     TheContainer()->GotoPane()->PopupList()->HidePopupL();
   327                         {
   324                     }
   328                         TheContainer()->GotoPane()->PopupList()->SetDirectoryModeL( ETrue );
   325                 GotoUrlInGotoPaneL();
   329                         TheContainer()->GotoPane()->PopupList()->HidePopupL();
   326                 }
   330                         }
   327             break;
   331                     GotoUrlInGotoPaneL();
   328             }
   332                     }
   329 
   333                 }
       
   334             else // it was from searchpane 
       
   335                 {
       
   336                 if (TheContainer()->SearchPane()->Editor()->TextLength()!= 0)
       
   337                     {
       
   338                     // Launch Search application with search parameters
       
   339                     // and cancel editing of search and goto.
       
   340                     // Dim Toolbar buttons
       
   341                     DimToolbarButtons(EFalse);
       
   342                     HBufC* searchString = TheContainer()->SearchPane()->GetTextL();
       
   343                     CleanupStack::PushL( searchString );
       
   344                     if( searchString )
       
   345                         {
       
   346                         UpdateCbaL();
       
   347                         // Set GoTo/Search Inactive
       
   348                         TheContainer()->SetGotoInactiveL();
       
   349                         LaunchSearchApplicationL( *searchString );
       
   350                         }
       
   351                     CleanupStack::PopAndDestroy( searchString );
       
   352                     }
       
   353                 // set LSK to GOTO now
       
   354                 UpdateCbaL();
       
   355                 }
       
   356             break;
       
   357             }
   330         case EWmlCmdGotoPaneSelect:
   358         case EWmlCmdGotoPaneSelect:
   331             {
   359             {
   332             if (TheContainer()->GotoPane()->Editor()->TextLength()!= 0)
   360             if (TheContainer()->GotoPane()->Editor()->TextLength()!= 0)
   333                 {
   361                 {
   334                 // Cancel editing and sets Goto Pane text back.
   362                 // Cancel editing and sets Goto Pane text back.
   459             {
   487             {
   460             AddNewBookmarkL();
   488             AddNewBookmarkL();
   461             break;
   489             break;
   462             }
   490             }
   463 
   491 
       
   492         case EWmlCmdGoToAddressAndSearch:    
   464         case EWmlCmdGoToAddress: // MSK for Recent Url page
   493         case EWmlCmdGoToAddress: // MSK for Recent Url page
   465         case EWmlCmdSwitchToGotoActive:
   494         case EWmlCmdSwitchToGotoActive:
   466             {
   495             {
   467             DimToolbarButtons(ETrue);
   496             DimToolbarButtons(ETrue);
   468             TheContainer()->SetGotoActiveL();
   497             TheContainer()->SetGotoActiveL();
   469             break;
   498             break;
   470             }
   499             }
   471 
   500 
       
   501         case EIsCmdSearchWeb:
       
   502         	{
       
   503         	DimToolbarButtons(ETrue);
       
   504         	TheContainer()->SetSearchActiveL();
       
   505         	break;
       
   506         	}
   472 
   507 
   473         case EWmlCmdEditBookmark:
   508         case EWmlCmdEditBookmark:
   474             {
   509             {
   475             EditCurrentBookmarkL();
   510             EditCurrentBookmarkL();
   476             break;
   511             break;
   811 //
   846 //
   812 
   847 
   813 void CBrowserBookmarksView::SetLSKDynL(TSKPair& aLsk,
   848 void CBrowserBookmarksView::SetLSKDynL(TSKPair& aLsk,
   814     CBrowserBookmarksGotoPane* aGotoPane)
   849     CBrowserBookmarksGotoPane* aGotoPane)
   815 {
   850 {
       
   851     CBrowserBookmarksContainer* theContainer = TheContainer();
       
   852     CBrowserBookmarksGotoPane* searchPane = NULL;
       
   853     if( theContainer )
       
   854         {
       
   855         searchPane = theContainer->SearchPane();
       
   856         }
   816     // Default lsk is option
   857     // Default lsk is option
   817     aLsk.setPair(EAknSoftkeyOptions, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_OPTION);
   858     aLsk.setPair(EAknSoftkeyOptions, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_OPTION);
   818 
   859 
   819     if ( iManualItemMovingGoingOn )
   860     if ( iManualItemMovingGoingOn )
   820         {
   861         {
   841                 !iPenEnabled)
   882                 !iPenEnabled)
   842             {
   883             {
   843             // LSK Select is only for non-touch devices
   884             // LSK Select is only for non-touch devices
   844             aLsk.setPair(EWmlCmdGotoPaneSelect, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_SELECT);
   885             aLsk.setPair(EWmlCmdGotoPaneSelect, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_SELECT);
   845             }
   886             }
   846         }
   887 		}
       
   888 	else if(  searchPane && searchPane->IsEditing()  )
       
   889 		{
       
   890         aLsk.setPair(EWmlCmdGotoPaneGoTo, R_BROWSER_BOOKMARKS_DYN_SK_QTN_IS_SOFTK_SEARCH);
       
   891 	    }
   847 }
   892 }
   848 
   893 
   849 // ----------------------------------------------------------------------------
   894 // ----------------------------------------------------------------------------
   850 // CBrowserBookmarksView::SetRSKDynL
   895 // CBrowserBookmarksView::SetRSKDynL
   851 // ----------------------------------------------------------------------------
   896 // ----------------------------------------------------------------------------
   852 //
   897 //
   853 
   898 
   854 void CBrowserBookmarksView::SetRSKDynL(TSKPair& aRsk,
   899 void CBrowserBookmarksView::SetRSKDynL(TSKPair& aRsk,
   855     CBrowserBookmarksGotoPane* aGotoPane)
   900     CBrowserBookmarksGotoPane* aGotoPane)
   856 {
   901 {
       
   902     CBrowserBookmarksContainer* theContainer = TheContainer();
       
   903     CBrowserBookmarksGotoPane* searchPane = NULL;
       
   904     if( theContainer )
       
   905         {
       
   906         searchPane = theContainer->SearchPane();
       
   907         }
   857     if ( iManualItemMovingGoingOn )
   908     if ( iManualItemMovingGoingOn )
   858         {
   909         {
   859         aRsk.setPair(EBrowserBookmarksCmdCancel, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_CANCEL);
   910         aRsk.setPair(EBrowserBookmarksCmdCancel, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_CANCEL);
   860         }
   911         }
   861     else if ( aGotoPane && aGotoPane->IsEditing() )
   912 	else if( (aGotoPane && aGotoPane->IsEditing()) || (searchPane && searchPane->IsEditing()) )
   862         {
   913         {
   863         // default for goto is cancel
   914         // default for goto is cancel
   864         aRsk.setPair(EBrowserBookmarksCmdCancel, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_CANCEL);
   915         aRsk.setPair(EBrowserBookmarksCmdCancel, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_CANCEL);
   865         }
   916         }
   866     else
   917     else
   919     else
   970     else
   920         {
   971         {
   921         aMsk.setPair(EBrowserBookmarksCmdOpen, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_OPEN);
   972         aMsk.setPair(EBrowserBookmarksCmdOpen, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_OPEN);
   922         }
   973         }
   923 
   974 
       
   975 	CBrowserBookmarksContainer* theContainer = TheContainer();
       
   976     CBrowserBookmarksGotoPane* searchPane = NULL;
       
   977 	if( theContainer )
       
   978 	    {
       
   979 	    searchPane = theContainer->SearchPane();
       
   980 	    }
   924     //
   981     //
   925     // UNDER these special conditions, the msk is set differently:
   982     // UNDER these special conditions, the msk is set differently:
   926     //
   983     //
   927     if ( aGotoPane && aGotoPane->IsEditing() )
   984     if ( aGotoPane && aGotoPane->IsEditing() )
       
   985 	    {
       
   986 		// follow whatever the lsk is set to
       
   987 		aMsk = aLsk;
       
   988 	    }
       
   989 	else if(  searchPane && searchPane->IsEditing() )
   928         {
   990         {
   929         // follow whatever the lsk is set to
   991         // follow whatever the lsk is set to
   930         aMsk = aLsk;
   992         aMsk = aLsk;
   931         }
   993         }
   932     else
   994     else
   972         ,
  1034         ,
   973         MBookmarksGotoPaneObserver::TEvent aEvent
  1035         MBookmarksGotoPaneObserver::TEvent aEvent
   974         )
  1036         )
   975     {
  1037     {
   976 #ifdef _DEBUG
  1038 #ifdef _DEBUG
   977     __ASSERT_DEBUG( aGotoPane == TheContainer()->GotoPane(), \
  1039     __ASSERT_DEBUG( aGotoPane == TheContainer()->GotoPane() ||
       
  1040             aGotoPane == TheContainer()->SearchPane(), \
   978         Util::Panic( Util::EFavouritesInternal ) );
  1041         Util::Panic( Util::EFavouritesInternal ) );
   979 #endif
  1042 #endif
   980 
  1043 
   981     switch ( aEvent )
  1044     switch ( aEvent )
   982         {
  1045         {
  1070 
  1133 
  1071     if (iPenEnabled)
  1134     if (iPenEnabled)
  1072         {
  1135         {
  1073         Toolbar()->SetToolbarObserver(this);
  1136         Toolbar()->SetToolbarObserver(this);
  1074         }
  1137         }
  1075 
  1138     if ( ApiProvider().Preferences().SearchFeature() )
       
  1139         {
       
  1140         Toolbar()->HideItem( EWmlCmdGoToAddress, ETrue, ETrue );
       
  1141         }
       
  1142     else
       
  1143         {
       
  1144         Toolbar()->HideItem( EWmlCmdGoToAddressAndSearch, ETrue, EFalse );
       
  1145         }
  1076     }
  1146     }
  1077 
  1147 
  1078 // ----------------------------------------------------------------------------
  1148 // ----------------------------------------------------------------------------
  1079 // CBrowserBookmarksView::HandleListBoxEventL
  1149 // CBrowserBookmarksView::HandleListBoxEventL
  1080 // ----------------------------------------------------------------------------
  1150 // ----------------------------------------------------------------------------
  1206             // history
  1276             // history
  1207             aMenuPane->SetItemDimmed( EWmlCmdHistory, ETrue );
  1277             aMenuPane->SetItemDimmed( EWmlCmdHistory, ETrue );
  1208 
  1278 
  1209             // home
  1279             // home
  1210             aMenuPane->SetItemDimmed( EWmlCmdLaunchHomePage, ETrue );
  1280             aMenuPane->SetItemDimmed( EWmlCmdLaunchHomePage, ETrue );
  1211 
  1281             //search 
       
  1282             if ( ! ApiProvider().Preferences().SearchFeature() )
       
  1283                 {
       
  1284                 aMenuPane->SetItemDimmed( EIsCmdSearchWeb, ETrue );
       
  1285                 }
  1212             break;
  1286             break;
  1213             }
  1287             }
  1214         case R_BMACTIONS_SUBMENU:
  1288         case R_BMACTIONS_SUBMENU:
  1215             {
  1289             {
  1216             // send
  1290             // send
  1470 CBrowserFavouritesContainer* CBrowserBookmarksView::CreateContainerL()
  1544 CBrowserFavouritesContainer* CBrowserBookmarksView::CreateContainerL()
  1471     {
  1545     {
  1472     CBrowserBookmarksContainer* container =
  1546     CBrowserBookmarksContainer* container =
  1473         CBrowserBookmarksContainer::NewL( ClientRect(), *this );
  1547         CBrowserBookmarksContainer::NewL( ClientRect(), *this );
  1474     container->GotoPane()->SetGPObserver( this );
  1548     container->GotoPane()->SetGPObserver( this );
       
  1549     if(  ApiProvider().Preferences().SearchFeature() )
       
  1550         container->SearchPane()->SetGPObserver( this );
  1475     return container;
  1551     return container;
  1476     }
  1552     }
  1477 
  1553 
  1478 // ----------------------------------------------------------------------------
  1554 // ----------------------------------------------------------------------------
  1479 // CBrowserBookmarksView::MoveItemsL
  1555 // CBrowserBookmarksView::MoveItemsL