cmmanager/cmmgr/Framework/Src/cmdlg.cpp
changeset 1 40cb640ef159
parent 0 5a93021fdf25
child 12 ea6e024ea6f9
equal deleted inserted replaced
0:5a93021fdf25 1:40cb640ef159
   185     
   185     
   186     if ( iHighlight )
   186     if ( iHighlight )
   187         {
   187         {
   188         iListbox->ScrollToMakeItemVisible( iHighlight );
   188         iListbox->ScrollToMakeItemVisible( iHighlight );
   189         iListbox->SetCurrentItemIndexAndDraw( iHighlight );
   189         iListbox->SetCurrentItemIndexAndDraw( iHighlight );
   190         }
   190         }    
   191     ShowPopupNoteL();        
       
   192     }
   191     }
   193     
   192     
   194 // --------------------------------------------------------------------------
   193 // --------------------------------------------------------------------------
   195 // CCmDlg::DynInitMenuPaneL
   194 // CCmDlg::DynInitMenuPaneL
   196 // --------------------------------------------------------------------------
   195 // --------------------------------------------------------------------------
   204     	if (aResourceId == R_CM_MENU && !iCmManager->IsHelpOn())
   203     	if (aResourceId == R_CM_MENU && !iCmManager->IsHelpOn())
   205             {
   204             {
   206             aMenuPane->DeleteMenuItem( EAknCmdHelp );		    
   205             aMenuPane->DeleteMenuItem( EAknCmdHelp );		    
   207             }
   206             }
   208         // Menu items
   207         // Menu items
       
   208     	TBool hideEdit      ( EFalse );
   209         TBool hideAdd       ( EFalse );
   209         TBool hideAdd       ( EFalse );
   210         TBool hideRename    ( EFalse );
   210         TBool hideRename    ( EFalse );
   211         TBool hideDelete    ( EFalse );
   211         TBool hideDelete    ( EFalse );
   212         TBool hideCopy      ( EFalse );
   212         TBool hideCopy      ( EFalse );
   213         TBool hideMove      ( EFalse );
   213         TBool hideMove      ( EFalse );
   216         // Edit, Rename, Delete and Organise menu items are hidden if:
   216         // Edit, Rename, Delete and Organise menu items are hidden if:
   217         // 1. CM List is empty
   217         // 1. CM List is empty
   218         // 2. Embedded Destinations
   218         // 2. Embedded Destinations
   219         if ( !( iListbox->Model()->ItemTextArray()->MdcaCount() ) )
   219         if ( !( iListbox->Model()->ItemTextArray()->MdcaCount() ) )
   220             {
   220             {
       
   221             hidePrioritise = ETrue;
       
   222             hideEdit = ETrue;
   221             hideRename  = ETrue;
   223             hideRename  = ETrue;
   222             hideDelete  = ETrue;
   224             hideDelete  = ETrue;
   223             hideCopy = ETrue;
   225             hideCopy = ETrue;
   224             hideMove = ETrue; 
   226             hideMove = ETrue;
   225             }
   227             }
   226         // Embedded destinations can be deleted but not edited
   228         // Embedded destinations can be deleted but not edited
   227         else if ( ( CurrentCML()->GetBoolAttributeL(ECmDestination) ) )
   229         else if ( ( CurrentCML()->GetBoolAttributeL(ECmDestination) ) )
   228             {
   230             {
   229             hideRename  = ETrue;
   231             hideRename  = ETrue;
   239             if ( CurrentCML()->GetIntAttributeL( ECmNextLayerSNAPId ) )
   241             if ( CurrentCML()->GetIntAttributeL( ECmNextLayerSNAPId ) )
   240                 {
   242                 {
   241                 hidePrioritise = ETrue;
   243                 hidePrioritise = ETrue;
   242                 }
   244                 }
   243             }
   245             }
   244         // No available destination to copy/move the CM to
   246      
   245         RArray<TUint32> destinations( KCmArrayMediumGranularity );
       
   246         CleanupClosePushL( destinations );
       
   247         iCmManager->AllDestinationsL( destinations );
       
   248         for ( TInt i = 0; i < destinations.Count(); i++ )
       
   249             {            
       
   250             CCmDestinationImpl* dest = 
       
   251                                     iCmManager->DestinationL( destinations[i] );
       
   252             CleanupStack::PushL( dest );
       
   253             // Not allowed to copy/move CMs into Level1 protected destinations
       
   254             if ( dest->ProtectionLevel() != CMManager::EProtLevel1 )
       
   255                 {
       
   256                 // iCmDestinationImpl is null in Uncat dlg - ignore
       
   257                 // Don't count the current destination
       
   258                 if ( !iCmDestinationImpl || 
       
   259                      dest->Id() != iCmDestinationImpl->Id() ) 
       
   260                     {
       
   261                     hideCopy = EFalse;
       
   262                     hideMove = EFalse;
       
   263                     CleanupStack::PopAndDestroy( dest );
       
   264                     break;
       
   265                     }
       
   266                 }
       
   267             CleanupStack::PopAndDestroy( dest );                
       
   268             }
       
   269         CleanupStack::PopAndDestroy( &destinations );    
       
   270         
       
   271         // Show or hide menu items
   247         // Show or hide menu items
   272         if ( aResourceId == R_CM_MENU )
   248         if ( aResourceId == R_CM_MENU )
   273             {            
   249             {            
       
   250             aMenuPane->SetItemDimmed( ECmManagerUiCmdCmEdit,    hideEdit );
   274             aMenuPane->SetItemDimmed( ECmManagerUiCmdCmAdd,     hideAdd );
   251             aMenuPane->SetItemDimmed( ECmManagerUiCmdCmAdd,     hideAdd );
   275             aMenuPane->SetItemDimmed( ECmManagerUiCmdCmRename,  hideRename );            
   252             aMenuPane->SetItemDimmed( ECmManagerUiCmdCmRename,  hideRename );            
   276             aMenuPane->SetItemDimmed( ECmManagerUiCmdCmDelete,  hideDelete );    
   253             aMenuPane->SetItemDimmed( ECmManagerUiCmdCmDelete,  hideDelete );    
   277             aMenuPane->SetItemDimmed( ECmManagerUiCmdCmPrioritise, hidePrioritise );
   254             aMenuPane->SetItemDimmed( ECmManagerUiCmdCmPrioritise, hidePrioritise );
   278             aMenuPane->SetItemDimmed( ECmManagerUiCmdCmMoveToOtherDestination, hideMove );
   255             aMenuPane->SetItemDimmed( ECmManagerUiCmdCmMoveToOtherDestination, hideMove );
  1294             }
  1271             }
  1295         }
  1272         }
  1296     }
  1273     }
  1297     
  1274     
  1298 // ---------------------------------------------------------------------------
  1275 // ---------------------------------------------------------------------------
  1299 // CCmDlg::ShowPopupNote
       
  1300 // ---------------------------------------------------------------------------
       
  1301 //
       
  1302 void CCmDlg::ShowPopupNoteL()
       
  1303     {
       
  1304     if ( iInfoPopupNoteController )
       
  1305         {
       
  1306         if ( iListbox->Model()->NumberOfItems() && !iPrioritising )
       
  1307             {
       
  1308             // Value is only shown for concrete bearer types - allow to leave
       
  1309             HBufC* bearer = NULL;
       
  1310             TRAPD( err, bearer = 
       
  1311                 CurrentCML()->GetStringAttributeL( ECmBearerNamePopupNote ) );
       
  1312 
       
  1313             if ( !err )
       
  1314                 {
       
  1315                 CleanupStack::PushL( bearer );
       
  1316                 
       
  1317                 HBufC* title = StringLoader::LoadLC( 
       
  1318                                     R_CMMANAGERUI_POPUP_TITLE_DATA_BEARER );
       
  1319 
       
  1320                 HBufC* noteText = HBufC::NewLC( title->Size() + 
       
  1321                                                1 + 
       
  1322                                                bearer->Size() );
       
  1323                 noteText->Des().Append( *title );
       
  1324                 noteText->Des().Append( KCmNewLine );
       
  1325                 noteText->Des().Append( *bearer );        
       
  1326                 iInfoPopupNoteController->SetTextL( *noteText );
       
  1327                 iInfoPopupNoteController->ShowInfoPopupNote();
       
  1328                 
       
  1329                 CleanupStack::PopAndDestroy( 3, bearer );
       
  1330                 }
       
  1331             else
       
  1332                 {
       
  1333                 iInfoPopupNoteController->HideInfoPopupNote();
       
  1334                 }
       
  1335             }
       
  1336         }  
       
  1337     }
       
  1338 
       
  1339 // ---------------------------------------------------------------------------
       
  1340 // CCmDlg::OfferKeyEventL
  1276 // CCmDlg::OfferKeyEventL
  1341 // ---------------------------------------------------------------------------
  1277 // ---------------------------------------------------------------------------
  1342 //
  1278 //
  1343 TKeyResponse CCmDlg::OfferKeyEventL( const TKeyEvent& aKeyEvent, 
  1279 TKeyResponse CCmDlg::OfferKeyEventL( const TKeyEvent& aKeyEvent, 
  1344                                      TEventCode aType )    
  1280                                      TEventCode aType )    
  1374             retVal = CAknDialog::OfferKeyEventL( aKeyEvent, aType );
  1310             retVal = CAknDialog::OfferKeyEventL( aKeyEvent, aType );
  1375             }
  1311             }
  1376         }
  1312         }
  1377     else
  1313     else
  1378         {
  1314         {
  1379         retVal = iListbox->OfferKeyEventL(aKeyEvent, aType);
  1315         retVal = iListbox->OfferKeyEventL(aKeyEvent, aType);       
  1380         if ( aKeyEvent.iCode == EKeyUpArrow || 
       
  1381              aKeyEvent.iCode == EKeyDownArrow )
       
  1382             {
       
  1383             ShowPopupNoteL();
       
  1384             }            
       
  1385         }
  1316         }
  1386 
  1317 
  1387     return retVal;
  1318     return retVal;
  1388     }
  1319     }
  1389 // ---------------------------------------------------------------------------
  1320 // ---------------------------------------------------------------------------
  1803             iCmDestinationImpl->ModifyPriorityL( 
  1734             iCmDestinationImpl->ModifyPriorityL( 
  1804                                 *cm, 
  1735                                 *cm, 
  1805                                 iListbox->CurrentItemIndex());
  1736                                 iListbox->CurrentItemIndex());
  1806             iCmDestinationImpl->UpdateL();
  1737             iCmDestinationImpl->UpdateL();
  1807             HandleListboxDataChangeL();
  1738             HandleListboxDataChangeL();
  1808             ShowPopupNoteL();
       
  1809             }
  1739             }
  1810         }
  1740         }
  1811      // Set the softkeys back    
  1741      // Set the softkeys back    
  1812      ButtonGroupContainer().SetCommandSetL(
  1742      ButtonGroupContainer().SetCommandSetL(
  1813                                     R_SOFTKEYS_OPTIONS_BACK__EDIT );
  1743                                     R_SOFTKEYS_OPTIONS_BACK__EDIT );