idlehomescreen/xmluirendering/uiengine/src/xneditor.cpp
branchRCL_3
changeset 35 3321d3e205b6
parent 34 5456b4e8b3a8
equal deleted inserted replaced
34:5456b4e8b3a8 35:3321d3e205b6
   233         {
   233         {
   234         CXnNode* node( nodes[i] );
   234         CXnNode* node( nodes[i] );
   235 
   235 
   236         CXnPluginData* plugin( viewData.Plugin( node ) );
   236         CXnPluginData* plugin( viewData.Plugin( node ) );
   237 
   237 
   238         if ( plugin && !plugin->Occupied() )
   238         if ( plugin && !plugin->Occupied() && plugin->Editable() )
   239             {
   239             {
   240             return plugin;
   240             return plugin;
   241             }
   241             }
   242         }
   242         }
   243 
   243 
  1083                     XnPropertyNames::style::common::KDisplay,
  1083                     XnPropertyNames::style::common::KDisplay,
  1084                     XnPropertyNames::style::common::display::KNone );                
  1084                     XnPropertyNames::style::common::display::KNone );                
  1085                 }
  1085                 }
  1086             }
  1086             }
  1087         }                           
  1087         }                           
       
  1088     }
       
  1089 
       
  1090 // -----------------------------------------------------------------------------
       
  1091 // CXnEditor::NotifyViewLoadedL
       
  1092 // -----------------------------------------------------------------------------
       
  1093 //
       
  1094 void CXnEditor::NotifyViewLoadedL( const CXnViewData& /*aViewData*/ )
       
  1095     {
  1088     }
  1096     }
  1089 
  1097 
  1090 // ---------------------------------------------------------------------------
  1098 // ---------------------------------------------------------------------------
  1091 // CXnEditor::NotifyConfigureWidgetL
  1099 // CXnEditor::NotifyConfigureWidgetL
  1092 // ---------------------------------------------------------------------------
  1100 // ---------------------------------------------------------------------------
  1337 
  1345 
  1338 // ---------------------------------------------------------------------------
  1346 // ---------------------------------------------------------------------------
  1339 // CXnEditor::NotifyViewAdditionL
  1347 // CXnEditor::NotifyViewAdditionL
  1340 // ---------------------------------------------------------------------------
  1348 // ---------------------------------------------------------------------------
  1341 //
  1349 //
  1342 void CXnEditor::NotifyViewAdditionL( const CXnPluginData& /*aPluginData*/ )
  1350 void CXnEditor::NotifyViewAdditionL( const CXnViewData& /*aViewData*/ )
  1343     {
  1351     {
  1344     NotifyViewListChanged();
  1352     NotifyViewListChanged();
  1345     }
  1353     }
  1346 
  1354 
  1347 // ---------------------------------------------------------------------------
  1355 // ---------------------------------------------------------------------------
  1348 // CXnEditor::NotifyViewRemovalL
  1356 // CXnEditor::NotifyViewRemovalL
  1349 // ---------------------------------------------------------------------------
  1357 // ---------------------------------------------------------------------------
  1350 //
  1358 //
  1351 void CXnEditor::NotifyViewRemovalL( const CXnPluginData& /*aPluginData*/ )
  1359 void CXnEditor::NotifyViewRemovalL( const CXnViewData& /*aViewData*/ )
  1352     {
  1360     {
  1353     NotifyViewListChanged();
  1361     NotifyViewListChanged();
  1354     }
  1362     }
  1355 
  1363 
  1356 // ---------------------------------------------------------------------------
  1364 // ---------------------------------------------------------------------------
  1420     // start waiting for new updates again. 
  1428     // start waiting for new updates again. 
  1421     iNotifyWidgetListChanged->Start(
  1429     iNotifyWidgetListChanged->Start(
  1422         KNotifyWidgetListChangedDelay,
  1430         KNotifyWidgetListChangedDelay,
  1423         KNotifyWidgetListChangedDelay,
  1431         KNotifyWidgetListChangedDelay,
  1424         TCallBack( WidgetListChangedCallBack, this ) );
  1432         TCallBack( WidgetListChangedCallBack, this ) );
  1425 
       
  1426     }
  1433     }
  1427 
  1434 
  1428 // ---------------------------------------------------------------------------
  1435 // ---------------------------------------------------------------------------
  1429 // CXnEditor::WidgetListChangedCallBack
  1436 // CXnEditor::WidgetListChangedCallBack
  1430 // ---------------------------------------------------------------------------
  1437 // ---------------------------------------------------------------------------
  1926     TInt ret( KErrNone );    
  1933     TInt ret( KErrNone );    
  1927 
  1934 
  1928     const TDesC8& type( aInfo.Type() );
  1935     const TDesC8& type( aInfo.Type() );
  1929     
  1936     
  1930     if ( ( type != KKeyWidget && type != KKeyTemplate ) ||
  1937     if ( ( type != KKeyWidget && type != KKeyTemplate ) ||
  1931          aInfo.Uid() == KNullDesC8  || !aInfo.CanBeAdded() )
  1938          aInfo.Uid() == KNullDesC8 )
  1932         {
  1939         {
  1933         // malformed content info
  1940         // malformed content info
  1934         return KErrArgument;
  1941         return KErrArgument;
  1935         }
  1942         }
  1936 
  1943 
       
  1944     // the widget can not be added. Return proper error code
       
  1945     if ( IsCurrentViewFull() )
       
  1946         {
       
  1947         return KHsErrorViewFull;
       
  1948         }
       
  1949     else if ( !aInfo.CanBeAdded() )
       
  1950         {
       
  1951         return KHsErrorMaxInstanceCountExceeded;
       
  1952         }
       
  1953 
       
  1954 
  1937     CXnPluginData* plugin( NULL );
  1955     CXnPluginData* plugin( NULL );
  1938     
  1956     
  1939     if( iTargetPlugin )
  1957     if( iTargetPlugin )
  1940         {
  1958         {
  1941         plugin = DeterminePlugin( iViewManager, iTargetPlugin );
  1959         plugin = DeterminePlugin( iViewManager, iTargetPlugin );
  1945         plugin = DeterminePlugin( iViewManager );
  1963         plugin = DeterminePlugin( iViewManager );
  1946         }
  1964         }
  1947     
  1965     
  1948     iTargetPlugin = NULL;
  1966     iTargetPlugin = NULL;
  1949     
  1967     
  1950     // the widget can not be added. Return proper error code
  1968     if ( !plugin )
  1951     if ( IsCurrentViewFull() || !plugin )
  1969         {
  1952         {
  1970         return KErrGeneral;
  1953         return KHsErrorViewFull;
       
  1954         }
       
  1955     else
       
  1956         {
       
  1957         TInt result;
       
  1958         if ( aInfo.Type() != KKeyTemplate() )
       
  1959             { 
       
  1960             result = NonTemplateWidgetCanBeAddedRemovedL( aInfo ); 
       
  1961             }
       
  1962         else
       
  1963             {
       
  1964             result = TemplateWidgetCanBeAddedRemovedL( aInfo );
       
  1965             } 
       
  1966         
       
  1967         if ( !( result & ECanBeAdded ) )
       
  1968             {
       
  1969             return KHsErrorMaxInstanceCountExceeded;
       
  1970             } 
       
  1971         }
  1971         }
  1972     
  1972     
  1973     ret = iViewManager.LoadWidgetToPluginL( aInfo, *plugin );
  1973     ret = iViewManager.LoadWidgetToPluginL( aInfo, *plugin );
  1974     
  1974     
  1975     if( ret == KErrNone )
  1975     if( ret == KErrNone )
  2191 
  2191 
  2192     for ( TInt i = 0; i < plugins.Count(); i++ )
  2192     for ( TInt i = 0; i < plugins.Count(); i++ )
  2193         {
  2193         {
  2194         CXnPluginData* plugin = plugins[ i ];
  2194         CXnPluginData* plugin = plugins[ i ];
  2195 
  2195 
  2196         if ( !plugin->Occupied() )
  2196         if ( plugin && !plugin->Occupied() && plugin->Editable() )
  2197             {
  2197             {
  2198             isFull = EFalse;
  2198             isFull = EFalse;
  2199             break;
  2199             break;
  2200             }
  2200             }
  2201         }
  2201         }