browserui/browser/FavouritesSrc/BrowserBookmarksView.cpp
changeset 10 57d5b8e231c4
parent 0 84ad3b177aa3
child 18 4530440261a8
--- a/browserui/browser/FavouritesSrc/BrowserBookmarksView.cpp	Mon Mar 30 12:49:49 2009 +0300
+++ b/browserui/browser/FavouritesSrc/BrowserBookmarksView.cpp	Fri May 08 08:18:43 2009 +0300
@@ -119,6 +119,8 @@
     if ( container )
         {
         container->GotoPane()->SetGPObserver( NULL );
+        if( ApiProvider().Preferences().SearchFeature() )
+            container->SearchPane()->SetGPObserver( NULL );
         }
     delete iDomainFolderName;
     delete iItemsToMove;
@@ -248,7 +250,9 @@
                 {
                 ProcessCommandL(EWmlCmdMoveCancel);
                 }
-            else if ( TheContainer() && TheContainer()->GotoPane()->IsEditing() )
+			else if( TheContainer() 
+			        && ( TheContainer()->GotoPane()->IsEditing() 
+			        || TheContainer()->SearchPane()->IsEditing()))
                 {
                 ProcessCommandL(EWmlCmdGotoPaneCancel);
                 }
@@ -314,19 +318,43 @@
         // CBA commands.
         case EWmlCmdGotoPaneGoTo:
             {
-            if (TheContainer()->GotoPane()->Editor()->TextLength()!= 0)
+            if( TheContainer()->GotoPaneActive() )
                 {
-                // Cancel editing and sets Goto Pane text back.
-                if (TheContainer()->GotoPane()->PopupList() != NULL)
+                if (TheContainer()->GotoPane()->Editor()->TextLength()!= 0)
+                    {
+                    // Cancel editing and sets Goto Pane text back.
+                    if (TheContainer()->GotoPane()->PopupList() != NULL)
+                        {
+                        TheContainer()->GotoPane()->PopupList()->SetDirectoryModeL( ETrue );
+                        TheContainer()->GotoPane()->PopupList()->HidePopupL();
+                        }
+                    GotoUrlInGotoPaneL();
+                    }
+                }
+            else // it was from searchpane 
+                {
+                if (TheContainer()->SearchPane()->Editor()->TextLength()!= 0)
                     {
-                    TheContainer()->GotoPane()->PopupList()->SetDirectoryModeL( ETrue );
-                    TheContainer()->GotoPane()->PopupList()->HidePopupL();
+                    // Launch Search application with search parameters
+                    // and cancel editing of search and goto.
+                    // Dim Toolbar buttons
+                    DimToolbarButtons(EFalse);
+                    HBufC* searchString = TheContainer()->SearchPane()->GetTextL();
+                    CleanupStack::PushL( searchString );
+                    if( searchString )
+                        {
+                        UpdateCbaL();
+                        // Set GoTo/Search Inactive
+                        TheContainer()->SetGotoInactiveL();
+                        LaunchSearchApplicationL( *searchString );
+                        }
+                    CleanupStack::PopAndDestroy( searchString );
                     }
-                GotoUrlInGotoPaneL();
+                // set LSK to GOTO now
+                UpdateCbaL();
                 }
             break;
             }
-
         case EWmlCmdGotoPaneSelect:
             {
             if (TheContainer()->GotoPane()->Editor()->TextLength()!= 0)
@@ -461,6 +489,7 @@
             break;
             }
 
+        case EWmlCmdGoToAddressAndSearch:    
         case EWmlCmdGoToAddress: // MSK for Recent Url page
         case EWmlCmdSwitchToGotoActive:
             {
@@ -469,6 +498,12 @@
             break;
             }
 
+        case EIsCmdSearchWeb:
+        	{
+        	DimToolbarButtons(ETrue);
+        	TheContainer()->SetSearchActiveL();
+        	break;
+        	}
 
         case EWmlCmdEditBookmark:
             {
@@ -813,6 +848,12 @@
 void CBrowserBookmarksView::SetLSKDynL(TSKPair& aLsk,
     CBrowserBookmarksGotoPane* aGotoPane)
 {
+    CBrowserBookmarksContainer* theContainer = TheContainer();
+    CBrowserBookmarksGotoPane* searchPane = NULL;
+    if( theContainer )
+        {
+        searchPane = theContainer->SearchPane();
+        }
     // Default lsk is option
     aLsk.setPair(EAknSoftkeyOptions, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_OPTION);
 
@@ -843,7 +884,11 @@
             // LSK Select is only for non-touch devices
             aLsk.setPair(EWmlCmdGotoPaneSelect, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_SELECT);
             }
-        }
+		}
+	else if(  searchPane && searchPane->IsEditing()  )
+		{
+        aLsk.setPair(EWmlCmdGotoPaneGoTo, R_BROWSER_BOOKMARKS_DYN_SK_QTN_IS_SOFTK_SEARCH);
+	    }
 }
 
 // ----------------------------------------------------------------------------
@@ -854,11 +899,17 @@
 void CBrowserBookmarksView::SetRSKDynL(TSKPair& aRsk,
     CBrowserBookmarksGotoPane* aGotoPane)
 {
+    CBrowserBookmarksContainer* theContainer = TheContainer();
+    CBrowserBookmarksGotoPane* searchPane = NULL;
+    if( theContainer )
+        {
+        searchPane = theContainer->SearchPane();
+        }
     if ( iManualItemMovingGoingOn )
         {
         aRsk.setPair(EBrowserBookmarksCmdCancel, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_CANCEL);
         }
-    else if ( aGotoPane && aGotoPane->IsEditing() )
+	else if( (aGotoPane && aGotoPane->IsEditing()) || (searchPane && searchPane->IsEditing()) )
         {
         // default for goto is cancel
         aRsk.setPair(EBrowserBookmarksCmdCancel, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_CANCEL);
@@ -921,10 +972,21 @@
         aMsk.setPair(EBrowserBookmarksCmdOpen, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_OPEN);
         }
 
+	CBrowserBookmarksContainer* theContainer = TheContainer();
+    CBrowserBookmarksGotoPane* searchPane = NULL;
+	if( theContainer )
+	    {
+	    searchPane = theContainer->SearchPane();
+	    }
     //
     // UNDER these special conditions, the msk is set differently:
     //
     if ( aGotoPane && aGotoPane->IsEditing() )
+	    {
+		// follow whatever the lsk is set to
+		aMsk = aLsk;
+	    }
+	else if(  searchPane && searchPane->IsEditing() )
         {
         // follow whatever the lsk is set to
         aMsk = aLsk;
@@ -974,7 +1036,8 @@
         )
     {
 #ifdef _DEBUG
-    __ASSERT_DEBUG( aGotoPane == TheContainer()->GotoPane(), \
+    __ASSERT_DEBUG( aGotoPane == TheContainer()->GotoPane() ||
+            aGotoPane == TheContainer()->SearchPane(), \
         Util::Panic( Util::EFavouritesInternal ) );
 #endif
 
@@ -1072,7 +1135,14 @@
         {
         Toolbar()->SetToolbarObserver(this);
         }
-
+    if ( ApiProvider().Preferences().SearchFeature() )
+        {
+        Toolbar()->HideItem( EWmlCmdGoToAddress, ETrue, ETrue );
+        }
+    else
+        {
+        Toolbar()->HideItem( EWmlCmdGoToAddressAndSearch, ETrue, EFalse );
+        }
     }
 
 // ----------------------------------------------------------------------------
@@ -1208,7 +1278,11 @@
 
             // home
             aMenuPane->SetItemDimmed( EWmlCmdLaunchHomePage, ETrue );
-
+            //search 
+            if ( ! ApiProvider().Preferences().SearchFeature() )
+                {
+                aMenuPane->SetItemDimmed( EIsCmdSearchWeb, ETrue );
+                }
             break;
             }
         case R_BMACTIONS_SUBMENU:
@@ -1472,6 +1546,8 @@
     CBrowserBookmarksContainer* container =
         CBrowserBookmarksContainer::NewL( ClientRect(), *this );
     container->GotoPane()->SetGPObserver( this );
+    if(  ApiProvider().Preferences().SearchFeature() )
+        container->SearchPane()->SetGPObserver( this );
     return container;
     }