browserui/browser/FavouritesSrc/BrowserBookmarksView.cpp
branchRCL_3
changeset 50 c9249d037530
parent 48 5c11946e75b3
child 52 25214794fad6
equal deleted inserted replaced
48:5c11946e75b3 50:c9249d037530
   880     else if ( aGotoPane && aGotoPane->IsEditing() )
   880     else if ( aGotoPane && aGotoPane->IsEditing() )
   881         {
   881         {
   882         // default for goto is go
   882         // default for goto is go
   883         aLsk.setPair(EWmlCmdGotoPaneGoTo, R_BROWSER_BOOKMARKS_DYN_SK_QTN_WML_SOFTK_GO);
   883         aLsk.setPair(EWmlCmdGotoPaneGoTo, R_BROWSER_BOOKMARKS_DYN_SK_QTN_WML_SOFTK_GO);
   884 
   884 
   885         // special goto cases
   885          if (aGotoPane->PopupList() &&
   886         if ( ApiProvider().Fetching() )
       
   887             {
       
   888             // No assignment. Set as default
       
   889             aLsk.setPair(EBrowserBookmarksCmdSoftkeyEmpty, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_EMPTY);
       
   890             }
       
   891         else if (aGotoPane->PopupList() &&
       
   892                 aGotoPane->PopupList()->IsOpenDirToShow() )
   886                 aGotoPane->PopupList()->IsOpenDirToShow() )
   893             {
   887             {
   894             aLsk.setPair(EBrowserBookmarksCmdOpen, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_OPEN);
   888             aLsk.setPair(EBrowserBookmarksCmdOpen, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_OPEN);
   895             }
   889             }
   896         else if (aGotoPane->PopupList() &&
   890         else if (aGotoPane->PopupList() &&
  1123                             ApiProvider().Preferences().AdaptiveBookmarks();
  1117                             ApiProvider().Preferences().AdaptiveBookmarks();
  1124     iEnteredURL = NULL;
  1118     iEnteredURL = NULL;
  1125 BROWSER_LOG( ( _L("delete iEnteredUrl 3") ) );
  1119 BROWSER_LOG( ( _L("delete iEnteredUrl 3") ) );
  1126     iCursorPos = -1;
  1120     iCursorPos = -1;
  1127 
  1121 
  1128     // The following code gets all bookmarks and saves them back in the correct
       
  1129     // order in Favourites db. It was important to add this piece of code here
       
  1130     // in the constructor so that the first time when a bookmark is added
       
  1131     // through content view the correct index is used to insert the bookmark.
       
  1132     // TSW Error report id# MLEN-6Z8HMM
       
  1133 
       
  1134     iSaveBMOrder = ETrue;
       
  1135 
       
  1136     if ( Model().BeginL( /*aWrite=*/ETrue, /*aDbErrorNote*/ EFalse ) ==
       
  1137             KErrNone )
       
  1138         {
       
  1139         CFavouritesItemList* items = GetItemsLC( KFavouritesRootUid );
       
  1140         CleanupStack::PopAndDestroy();
       
  1141         Model().CommitL();
       
  1142         }
       
  1143        
  1122        
  1144     //Since the webcore will be reading the bookmark information in background
  1123     //Since the webcore will be reading the bookmark information in background
  1145     //thread, its important to refresh when the thread notifies the fresh data.
  1124     //thread, its important to refresh when the thread notifies the fresh data.
  1146     //Call to GetItemsLC above, which inturn calls ManualBMSortL will set iRefresh to false
  1125     //Call to GetItemsLC above, which inturn calls ManualBMSortL will set iRefresh to false
  1147     //Make it true so that latest FavIcon db info is shown     
  1126     //Make it true so that latest FavIcon db info is shown     
  1247 
  1226 
  1248     switch ( aResourceId )
  1227     switch ( aResourceId )
  1249         {
  1228         {
  1250         case R_BROWSER_BOOKMARKS_MENU_PANE:
  1229         case R_BROWSER_BOOKMARKS_MENU_PANE:
  1251             {
  1230             {
       
  1231 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF            
       
  1232             if(iItemsToMove )
       
  1233                 {
       
  1234                 aMenuPane->SetItemDimmed( EWmlCmdMove, ETrue );
       
  1235                 aMenuPane->SetItemDimmed( EWmlCmdMoveToFolder, ETrue );
       
  1236                 aMenuPane->SetItemDimmed( EWmlCmdDelete, ETrue );
       
  1237                 aMenuPane->SetItemDimmed( EWmlCmdSendAddressViaUnifiedMessage, ETrue );
       
  1238                 aMenuPane->SetItemDimmed( EWmlCmdSendBookmarkViaUnifiedMessage, ETrue );
       
  1239                 aMenuPane->SetItemDimmed( EWmlCmdSetAsHomePage, ETrue );
       
  1240                 }
       
  1241             else
       
  1242                 {
       
  1243                 if ( ApiProvider().Preferences().UiLocalFeatureSupported( KBrowserUiHomePageSetting ) )
       
  1244                     {
       
  1245                     TBool dimSaveAsHomePage = EFalse;
       
  1246     
       
  1247                     if ( (item && (item->IsFolder() ||
       
  1248                           item->Uid() == KFavouritesAdaptiveItemsFolderUid ||
       
  1249                           item->ContextId())))
       
  1250                         {
       
  1251                         dimSaveAsHomePage = ETrue;
       
  1252                         }
       
  1253                     else
       
  1254                         {
       
  1255                         dimSaveAsHomePage = ApiProvider().IsEmbeddedModeOn() || !aState.CurrentIsItem()
       
  1256                          || ( aState.MarkedCount() > 1 );
       
  1257                         }
       
  1258     
       
  1259                     aMenuPane->SetItemDimmed( EWmlCmdSetAsHomePage, dimSaveAsHomePage );
       
  1260                     }
       
  1261                 if (!item)
       
  1262                     {
       
  1263                     aMenuPane->SetItemDimmed( EWmlCmdSendBookmarkViaUnifiedMessage, ETrue );
       
  1264                     }
       
  1265                 else if ( (item && (item->IsFolder() ||
       
  1266                      item->Uid() == KFavouritesAdaptiveItemsFolderUid ||
       
  1267                      item->ContextId())))
       
  1268                     {
       
  1269                     aMenuPane->SetItemDimmed( EWmlCmdSendBookmarkViaUnifiedMessage, ETrue );
       
  1270                     }
       
  1271                 }
       
  1272             
       
  1273             aMenuPane->SetItemDimmed( EWmlCmdSendAddressViaUnifiedMessage, ETrue );
       
  1274     
       
  1275             if(iInAdaptiveBookmarksFolder)
       
  1276                 {
       
  1277                 aMenuPane->SetItemDimmed( EWmlCmdMove, ETrue );
       
  1278                 aMenuPane->SetItemDimmed( EWmlCmdMoveToFolder, ETrue );
       
  1279                 }
       
  1280             if  ( ( item ) &&
       
  1281                               ( ( item->Uid() == KFavouritesAdaptiveItemsFolderUid ) ||
       
  1282                                 ( item->ContextId() != NULL ) )
       
  1283                             )
       
  1284                 {
       
  1285                 // We can't delete adaptive bookmarks folder,
       
  1286                 //   or seamless folders
       
  1287                 aMenuPane->SetItemDimmed( EWmlCmdDelete, ETrue );
       
  1288                 aMenuPane->SetItemDimmed( EWmlCmdMoveToFolder, ETrue );
       
  1289                 }
       
  1290             if( item && item->IsFolder())
       
  1291                 {
       
  1292                 aMenuPane->SetItemDimmed( EWmlCmdMoveToFolder, ETrue );
       
  1293                 }
       
  1294 #endif                    
  1252             // downloads
  1295             // downloads
  1253             aMenuPane->SetItemDimmed( EWmlCmdDownloads, !ApiProvider().BrCtlInterface().BrowserSettingL( TBrCtlDefs::ESettingsNumOfDownloads ) );
  1296             aMenuPane->SetItemDimmed( EWmlCmdDownloads, !ApiProvider().BrCtlInterface().BrowserSettingL( TBrCtlDefs::ESettingsNumOfDownloads ) );
  1254 
  1297 
  1255             // edit
  1298             // edit
  1256             if ( !item || (iInAdaptiveBookmarksFolder && aState.IsEmpty() ))
  1299             if ( !item || (iInAdaptiveBookmarksFolder && aState.IsEmpty() ))
  1322                 }
  1365                 }
  1323             break;
  1366             break;
  1324             }
  1367             }
  1325         case R_BMACTIONS_SUBMENU:
  1368         case R_BMACTIONS_SUBMENU:
  1326             {
  1369             {
       
  1370 #ifndef BRDO_SINGLE_CLICK_ENABLED_FF            
  1327             // send
  1371             // send
  1328             aMenuPane->SetItemDimmed( EWmlCmdSendAddressViaUnifiedMessage, ETrue );
  1372             aMenuPane->SetItemDimmed( EWmlCmdSendAddressViaUnifiedMessage, ETrue );
  1329 
  1373 
  1330             if (!item)
  1374             if (!item)
  1331                 {
  1375                 {
  1335                  item->Uid() == KFavouritesAdaptiveItemsFolderUid ||
  1379                  item->Uid() == KFavouritesAdaptiveItemsFolderUid ||
  1336                  item->ContextId())))
  1380                  item->ContextId())))
  1337                 {
  1381                 {
  1338                 aMenuPane->SetItemDimmed( EWmlCmdSendBookmarkViaUnifiedMessage, ETrue );
  1382                 aMenuPane->SetItemDimmed( EWmlCmdSendBookmarkViaUnifiedMessage, ETrue );
  1339                 }
  1383                 }
  1340 
  1384 #endif            
  1341             // copy to bookmarks
  1385             // copy to bookmarks
  1342             if ( !iInAdaptiveBookmarksFolder )
  1386             if ( !iInAdaptiveBookmarksFolder )
  1343                 {
  1387                 {
  1344                 aMenuPane->SetItemDimmed( EWmlCmdCopyToBookmarks, ETrue );
  1388                 aMenuPane->SetItemDimmed( EWmlCmdCopyToBookmarks, ETrue );
  1345                 }
  1389                 }
  1346 
  1390 #ifndef BRDO_SINGLE_CLICK_ENABLED_FF 
  1347             // set as homepage
  1391             // set as homepage
  1348             if ( ApiProvider().Preferences().UiLocalFeatureSupported( KBrowserUiHomePageSetting ) )
  1392             if ( ApiProvider().Preferences().UiLocalFeatureSupported( KBrowserUiHomePageSetting ) )
  1349                 {
  1393                 {
  1350                 TBool dimSaveAsHomePage = EFalse;
  1394                 TBool dimSaveAsHomePage = EFalse;
  1351 
  1395 
  1361                      || ( aState.MarkedCount() > 1 );
  1405                      || ( aState.MarkedCount() > 1 );
  1362                     }
  1406                     }
  1363 
  1407 
  1364                 aMenuPane->SetItemDimmed( EWmlCmdSetAsHomePage, dimSaveAsHomePage );
  1408                 aMenuPane->SetItemDimmed( EWmlCmdSetAsHomePage, dimSaveAsHomePage );
  1365                 }
  1409                 }
  1366 #ifndef BRDO_SINGLE_CLICK_ENABLED_FF
       
  1367             // add bookmark
  1410             // add bookmark
  1368             if ( iInAdaptiveBookmarksFolder )
  1411             if ( iInAdaptiveBookmarksFolder )
  1369                 {
  1412                 {
  1370                 aMenuPane->SetItemDimmed( EWmlCmdAddBookmark, ETrue );
  1413                 aMenuPane->SetItemDimmed( EWmlCmdAddBookmark, ETrue );
  1371                 }
  1414                 }
  1430             else
  1473             else
  1431                 {
  1474                 {
  1432                 aMenuPane->SetItemDimmed( EWmlCmdRename, ETrue );
  1475                 aMenuPane->SetItemDimmed( EWmlCmdRename, ETrue );
  1433                 }
  1476                 }
  1434 
  1477 
  1435 
  1478 #ifndef BRDO_SINGLE_CLICK_ENABLED_FF 
  1436             // delete
  1479             // delete
  1437             if (!item)
  1480             if (!item)
  1438                 {
  1481                 {
  1439                 aMenuPane->SetItemDimmed( EWmlCmdDelete, ETrue );
  1482                 aMenuPane->SetItemDimmed( EWmlCmdDelete, ETrue );
  1440                 }
  1483                 }
  1455             if ( !aState.AnyPlainItem() || (iCurrentFolder == KFavouritesRootUid &&
  1498             if ( !aState.AnyPlainItem() || (iCurrentFolder == KFavouritesRootUid &&
  1456                  iContainer && iContainer->Listbox() && !iContainer->Listbox()->AnyFoldersL()) )
  1499                  iContainer && iContainer->Listbox() && !iContainer->Listbox()->AnyFoldersL()) )
  1457                 {
  1500                 {
  1458                 aMenuPane->SetItemDimmed( EWmlCmdMoveToFolder, ETrue );
  1501                 aMenuPane->SetItemDimmed( EWmlCmdMoveToFolder, ETrue );
  1459                 }
  1502                 }
  1460 #ifndef BRDO_SINGLE_CLICK_ENABLED_FF
       
  1461             // create folder
  1503             // create folder
  1462             if ( iCurrentFolder != KFavouritesRootUid || iInAdaptiveBookmarksFolder )
  1504             if ( iCurrentFolder != KFavouritesRootUid || iInAdaptiveBookmarksFolder )
  1463                 {
  1505                 {
  1464                 aMenuPane->SetItemDimmed( EWmlCmdNewFolder, ETrue );
  1506                 aMenuPane->SetItemDimmed( EWmlCmdNewFolder, ETrue );
  1465                 }
  1507                 }
  2199     Toolbar()->SetItemDimmed( EWmlCmdAddBookmark, aDimButtons , ETrue );
  2241     Toolbar()->SetItemDimmed( EWmlCmdAddBookmark, aDimButtons , ETrue );
  2200     Toolbar()->SetItemDimmed( EWmlCmdGoToAddress, aDimButtons , ETrue );
  2242     Toolbar()->SetItemDimmed( EWmlCmdGoToAddress, aDimButtons , ETrue );
  2201     Toolbar()->SetItemDimmed( EWmlCmdGoToAddressAndSearch, aDimButtons , ETrue );
  2243     Toolbar()->SetItemDimmed( EWmlCmdGoToAddressAndSearch, aDimButtons , ETrue );
  2202 #ifndef BRDO_SINGLE_CLICK_ENABLED_FF
  2244 #ifndef BRDO_SINGLE_CLICK_ENABLED_FF
  2203     Toolbar()->SetItemDimmed( EWmlCmdDelete, aDimButtons , ETrue );
  2245     Toolbar()->SetItemDimmed( EWmlCmdDelete, aDimButtons , ETrue );
       
  2246 #else
       
  2247     Toolbar()->SetItemDimmed( EWmlCmdPreferences, aDimButtons , ETrue );
  2204 #endif
  2248 #endif
  2205     if (!aDimButtons)
  2249     if (!aDimButtons)
  2206         {
  2250         {
  2207         // when undimming buttons we may not want them all back on
  2251         // when undimming buttons we may not want them all back on
  2208         UpdateToolbarButtonsState();
  2252         UpdateToolbarButtonsState();