idlehomescreen/xmluirendering/uiengine/src/xneditor.cpp
branchRCL_3
changeset 35 3321d3e205b6
parent 34 5456b4e8b3a8
--- a/idlehomescreen/xmluirendering/uiengine/src/xneditor.cpp	Wed Sep 01 12:32:46 2010 +0100
+++ b/idlehomescreen/xmluirendering/uiengine/src/xneditor.cpp	Tue Sep 14 20:58:58 2010 +0300
@@ -235,7 +235,7 @@
 
         CXnPluginData* plugin( viewData.Plugin( node ) );
 
-        if ( plugin && !plugin->Occupied() )
+        if ( plugin && !plugin->Occupied() && plugin->Editable() )
             {
             return plugin;
             }
@@ -1087,6 +1087,14 @@
         }                           
     }
 
+// -----------------------------------------------------------------------------
+// CXnEditor::NotifyViewLoadedL
+// -----------------------------------------------------------------------------
+//
+void CXnEditor::NotifyViewLoadedL( const CXnViewData& /*aViewData*/ )
+    {
+    }
+
 // ---------------------------------------------------------------------------
 // CXnEditor::NotifyConfigureWidgetL
 // ---------------------------------------------------------------------------
@@ -1339,7 +1347,7 @@
 // CXnEditor::NotifyViewAdditionL
 // ---------------------------------------------------------------------------
 //
-void CXnEditor::NotifyViewAdditionL( const CXnPluginData& /*aPluginData*/ )
+void CXnEditor::NotifyViewAdditionL( const CXnViewData& /*aViewData*/ )
     {
     NotifyViewListChanged();
     }
@@ -1348,7 +1356,7 @@
 // CXnEditor::NotifyViewRemovalL
 // ---------------------------------------------------------------------------
 //
-void CXnEditor::NotifyViewRemovalL( const CXnPluginData& /*aPluginData*/ )
+void CXnEditor::NotifyViewRemovalL( const CXnViewData& /*aViewData*/ )
     {
     NotifyViewListChanged();
     }
@@ -1422,7 +1430,6 @@
         KNotifyWidgetListChangedDelay,
         KNotifyWidgetListChangedDelay,
         TCallBack( WidgetListChangedCallBack, this ) );
-
     }
 
 // ---------------------------------------------------------------------------
@@ -1928,12 +1935,23 @@
     const TDesC8& type( aInfo.Type() );
     
     if ( ( type != KKeyWidget && type != KKeyTemplate ) ||
-         aInfo.Uid() == KNullDesC8  || !aInfo.CanBeAdded() )
+         aInfo.Uid() == KNullDesC8 )
         {
         // malformed content info
         return KErrArgument;
         }
 
+    // the widget can not be added. Return proper error code
+    if ( IsCurrentViewFull() )
+        {
+        return KHsErrorViewFull;
+        }
+    else if ( !aInfo.CanBeAdded() )
+        {
+        return KHsErrorMaxInstanceCountExceeded;
+        }
+
+
     CXnPluginData* plugin( NULL );
     
     if( iTargetPlugin )
@@ -1947,27 +1965,9 @@
     
     iTargetPlugin = NULL;
     
-    // the widget can not be added. Return proper error code
-    if ( IsCurrentViewFull() || !plugin )
-        {
-        return KHsErrorViewFull;
-        }
-    else
+    if ( !plugin )
         {
-        TInt result;
-        if ( aInfo.Type() != KKeyTemplate() )
-            { 
-            result = NonTemplateWidgetCanBeAddedRemovedL( aInfo ); 
-            }
-        else
-            {
-            result = TemplateWidgetCanBeAddedRemovedL( aInfo );
-            } 
-        
-        if ( !( result & ECanBeAdded ) )
-            {
-            return KHsErrorMaxInstanceCountExceeded;
-            } 
+        return KErrGeneral;
         }
     
     ret = iViewManager.LoadWidgetToPluginL( aInfo, *plugin );
@@ -2193,7 +2193,7 @@
         {
         CXnPluginData* plugin = plugins[ i ];
 
-        if ( !plugin->Occupied() )
+        if ( plugin && !plugin->Occupied() && plugin->Editable() )
             {
             isFull = EFalse;
             break;