idlehomescreen/xmluirendering/uiengine/src/xneditor.cpp
branchRCL_3
changeset 102 ba63c83f4716
parent 93 b01126ce0bec
equal deleted inserted replaced
93:b01126ce0bec 102:ba63c83f4716
    55 #include "xnplugindata.h"
    55 #include "xnplugindata.h"
    56 #include "xnrootdata.h"
    56 #include "xnrootdata.h"
    57 #include "xnviewdata.h"
    57 #include "xnviewdata.h"
    58 #include "xnwallpaperview.h"
    58 #include "xnwallpaperview.h"
    59 #include "xnbackgroundmanager.h"
    59 #include "xnbackgroundmanager.h"
       
    60 #include "xnpopupcontroladapter.h"
    60 
    61 
    61 #include "xneditor.h"
    62 #include "xneditor.h"
    62 #include "xnpanic.h"
    63 #include "xnpanic.h"
    63 
    64 
    64 #include "xnoomsyshandler.h"
    65 #include "xnoomsyshandler.h"
   232         {
   233         {
   233         CXnNode* node( nodes[i] );
   234         CXnNode* node( nodes[i] );
   234 
   235 
   235         CXnPluginData* plugin( viewData.Plugin( node ) );
   236         CXnPluginData* plugin( viewData.Plugin( node ) );
   236 
   237 
   237         if ( plugin && !plugin->Occupied() && plugin->Editable() )
   238         if ( plugin && !plugin->Occupied() )
   238             {
   239             {
   239             return plugin;
   240             return plugin;
   240             }
   241             }
   241         }
   242         }
   242 
   243 
   626         {
   627         {
   627         ui = iViewManager.AppUiAdapter().HsContentController( oPaqDataStr ); 
   628         ui = iViewManager.AppUiAdapter().HsContentController( oPaqDataStr ); 
   628         }
   629         }
   629     if( ui )
   630     if( ui )
   630         {
   631         {
       
   632         CXnNode* popup( iViewManager.UiEngine().StylusPopupNode() );
       
   633         if ( popup )
       
   634             {
       
   635             CXnPopupControlAdapter* control =
       
   636                 static_cast< CXnPopupControlAdapter* >(
       
   637                         popup->Control() );
       
   638            
       
   639             if ( control )
       
   640                 {
       
   641                 control->HideMenuL();
       
   642                 }
       
   643             }
   631         ui->SetContentController( this );
   644         ui->SetContentController( this );
   632         ui->Activate();
   645         ui->Activate();
   633         
   646         
   634         return;
   647         return;
   635         }
   648         }
  1070                     XnPropertyNames::style::common::KDisplay,
  1083                     XnPropertyNames::style::common::KDisplay,
  1071                     XnPropertyNames::style::common::display::KNone );                
  1084                     XnPropertyNames::style::common::display::KNone );                
  1072                 }
  1085                 }
  1073             }
  1086             }
  1074         }                           
  1087         }                           
  1075     }
       
  1076 
       
  1077 // -----------------------------------------------------------------------------
       
  1078 // CXnEditor::NotifyViewLoadedL
       
  1079 // -----------------------------------------------------------------------------
       
  1080 //
       
  1081 void CXnEditor::NotifyViewLoadedL( const CXnViewData& /*aViewData*/ )
       
  1082     {
       
  1083     }
  1088     }
  1084 
  1089 
  1085 // ---------------------------------------------------------------------------
  1090 // ---------------------------------------------------------------------------
  1086 // CXnEditor::NotifyConfigureWidgetL
  1091 // CXnEditor::NotifyConfigureWidgetL
  1087 // ---------------------------------------------------------------------------
  1092 // ---------------------------------------------------------------------------
  1332 
  1337 
  1333 // ---------------------------------------------------------------------------
  1338 // ---------------------------------------------------------------------------
  1334 // CXnEditor::NotifyViewAdditionL
  1339 // CXnEditor::NotifyViewAdditionL
  1335 // ---------------------------------------------------------------------------
  1340 // ---------------------------------------------------------------------------
  1336 //
  1341 //
  1337 void CXnEditor::NotifyViewAdditionL( const CXnViewData& /*aViewData*/ )
  1342 void CXnEditor::NotifyViewAdditionL( const CXnPluginData& /*aPluginData*/ )
  1338     {
  1343     {
  1339     NotifyViewListChanged();
  1344     NotifyViewListChanged();
  1340     }
  1345     }
  1341 
  1346 
  1342 // ---------------------------------------------------------------------------
  1347 // ---------------------------------------------------------------------------
  1343 // CXnEditor::NotifyViewRemovalL
  1348 // CXnEditor::NotifyViewRemovalL
  1344 // ---------------------------------------------------------------------------
  1349 // ---------------------------------------------------------------------------
  1345 //
  1350 //
  1346 void CXnEditor::NotifyViewRemovalL( const CXnViewData& /*aViewData*/ )
  1351 void CXnEditor::NotifyViewRemovalL( const CXnPluginData& /*aPluginData*/ )
  1347     {
  1352     {
  1348     NotifyViewListChanged();
  1353     NotifyViewListChanged();
  1349     }
  1354     }
  1350 
  1355 
  1351 // ---------------------------------------------------------------------------
  1356 // ---------------------------------------------------------------------------
  1415     // start waiting for new updates again. 
  1420     // start waiting for new updates again. 
  1416     iNotifyWidgetListChanged->Start(
  1421     iNotifyWidgetListChanged->Start(
  1417         KNotifyWidgetListChangedDelay,
  1422         KNotifyWidgetListChangedDelay,
  1418         KNotifyWidgetListChangedDelay,
  1423         KNotifyWidgetListChangedDelay,
  1419         TCallBack( WidgetListChangedCallBack, this ) );
  1424         TCallBack( WidgetListChangedCallBack, this ) );
       
  1425 
  1420     }
  1426     }
  1421 
  1427 
  1422 // ---------------------------------------------------------------------------
  1428 // ---------------------------------------------------------------------------
  1423 // CXnEditor::WidgetListChangedCallBack
  1429 // CXnEditor::WidgetListChangedCallBack
  1424 // ---------------------------------------------------------------------------
  1430 // ---------------------------------------------------------------------------
  1920     TInt ret( KErrNone );    
  1926     TInt ret( KErrNone );    
  1921 
  1927 
  1922     const TDesC8& type( aInfo.Type() );
  1928     const TDesC8& type( aInfo.Type() );
  1923     
  1929     
  1924     if ( ( type != KKeyWidget && type != KKeyTemplate ) ||
  1930     if ( ( type != KKeyWidget && type != KKeyTemplate ) ||
  1925          aInfo.Uid() == KNullDesC8 )
  1931          aInfo.Uid() == KNullDesC8  || !aInfo.CanBeAdded() )
  1926         {
  1932         {
  1927         // malformed content info
  1933         // malformed content info
  1928         return KErrArgument;
  1934         return KErrArgument;
  1929         }
  1935         }
  1930 
  1936 
       
  1937     CXnPluginData* plugin( NULL );
       
  1938     
       
  1939     if( iTargetPlugin )
       
  1940         {
       
  1941         plugin = DeterminePlugin( iViewManager, iTargetPlugin );
       
  1942         }
       
  1943     else
       
  1944         {
       
  1945         plugin = DeterminePlugin( iViewManager );
       
  1946         }
       
  1947     
       
  1948     iTargetPlugin = NULL;
       
  1949     
  1931     // the widget can not be added. Return proper error code
  1950     // the widget can not be added. Return proper error code
  1932     if ( IsCurrentViewFull() )
  1951     if ( IsCurrentViewFull() || !plugin )
  1933         {
  1952         {
  1934         return KHsErrorViewFull;
  1953         return KHsErrorViewFull;
  1935         }
  1954         }
  1936     else if ( !aInfo.CanBeAdded() )
       
  1937         {
       
  1938         return KHsErrorMaxInstanceCountExceeded;
       
  1939         }
       
  1940 
       
  1941 
       
  1942     CXnPluginData* plugin( NULL );
       
  1943     
       
  1944     if( iTargetPlugin )
       
  1945         {
       
  1946         plugin = DeterminePlugin( iViewManager, iTargetPlugin );
       
  1947         }
       
  1948     else
  1955     else
  1949         {
  1956         {
  1950         plugin = DeterminePlugin( iViewManager );
  1957         TInt result;
  1951         }
  1958         if ( aInfo.Type() != KKeyTemplate() )
  1952     
  1959             { 
  1953     iTargetPlugin = NULL;
  1960             result = NonTemplateWidgetCanBeAddedRemovedL( aInfo ); 
  1954     
  1961             }
  1955     if ( !plugin )
  1962         else
  1956         {
  1963             {
  1957         return KErrGeneral;
  1964             result = TemplateWidgetCanBeAddedRemovedL( aInfo );
       
  1965             } 
       
  1966         
       
  1967         if ( !( result & ECanBeAdded ) )
       
  1968             {
       
  1969             return KHsErrorMaxInstanceCountExceeded;
       
  1970             } 
  1958         }
  1971         }
  1959     
  1972     
  1960     ret = iViewManager.LoadWidgetToPluginL( aInfo, *plugin );
  1973     ret = iViewManager.LoadWidgetToPluginL( aInfo, *plugin );
  1961     
  1974     
  1962     if( ret == KErrNone )
  1975     if( ret == KErrNone )
  2178 
  2191 
  2179     for ( TInt i = 0; i < plugins.Count(); i++ )
  2192     for ( TInt i = 0; i < plugins.Count(); i++ )
  2180         {
  2193         {
  2181         CXnPluginData* plugin = plugins[ i ];
  2194         CXnPluginData* plugin = plugins[ i ];
  2182 
  2195 
  2183         if ( plugin && !plugin->Occupied() && plugin->Editable() )
  2196         if ( !plugin->Occupied() )
  2184             {
  2197             {
  2185             isFull = EFalse;
  2198             isFull = EFalse;
  2186             break;
  2199             break;
  2187             }
  2200             }
  2188         }
  2201         }