webengine/device/src/DeviceLiwBinding.cpp
branchRCL_3
changeset 49 919f36ff910f
parent 48 79859ed3eea9
--- a/webengine/device/src/DeviceLiwBinding.cpp	Tue Aug 31 16:17:46 2010 +0300
+++ b/webengine/device/src/DeviceLiwBinding.cpp	Wed Sep 01 12:28:30 2010 +0100
@@ -21,12 +21,12 @@
 #include <interpreter.h>
 #include <date_object.h>
 #include <operations.h>
-#include <liwservicehandler.h>
-#include <rtsecmanager.h>
-#include <rtsecmgrutility.h>
-#include <rtsecmgrscriptsession.h>
-#include <rtsecmgrcommondef.h>
-#include <WidgetRegistryClient.h>
+#include <liwServiceHandler.h>
+#include <RTSecManager.h>
+#include <RTSecMgrUtility.h>
+#include <RTSecMgrScriptSession.h>
+#include <RTSecMgrCommonDef.h>
+#include <widgetregistryclient.h>
 #include <PropertyNameArray.h>
 #include <internal.h>
 #include <liwvariant.h>
@@ -42,6 +42,8 @@
 #include "DeviceLiwIterable.h"
 #include "DeviceLiwResult.h"
 
+
+
 using namespace KJS;
 using namespace LIW;
 
@@ -125,7 +127,7 @@
             }
 #ifdef BRDO_SEC_MGR_PROMPT_ENHANCEMENT_FF
 		m_scriptSession->SetPromptOption(RTPROMPTUI_PROVIDER);   //  This is for setting the new prompting method
-#endif
+#endif 
         CleanupStack::PopAndDestroy( trust );
     }
 
@@ -164,6 +166,7 @@
     if ( argcount > 0 && args[0]->type() == StringType &&
         args[0]->toString( exec ).size() > 0 )
         {
+       	  
             TRAP( error,
             {
             // Get service name
@@ -211,7 +214,7 @@
                 switch ( widgetregistry.WidgetSapiAccessState(m_Uid))
                     {
                     case SAPISECURITYPROMPTNEEDED :
-                        load_err = m_serviceHandler->AttachL( crit_arr, *m_scriptSession );
+                        load_err = sapiPromptNeededL(crit_arr);
                         break;
                     case SAPIPROMPTLESS :
                         load_err = m_serviceHandler->AttachL( crit_arr );
@@ -254,7 +257,21 @@
 
     return error;
     }
-
+    
+// ---------------------------------------------------------------------------
+// attachL called if sapi prompt is needed
+// return TInt - load error
+// ---------------------------------------------------------------------------
+//
+TInt CDeviceLiwBinding::sapiPromptNeededL(RCriteriaArray aCrit_arr)
+    {
+#ifdef BRDO_SAPINTFN_ENABLED_FF
+        return m_serviceHandler->AttachL( aCrit_arr, *m_scriptSession, m_Uid.iUid );
+#else
+        return m_serviceHandler->AttachL( aCrit_arr, *m_scriptSession );
+#endif
+    }
+    
 // ---------------------------------------------------------------------------
 // Convert Unload service provider
 // return JSValue - javascript list
@@ -1149,13 +1166,16 @@
         }
 
     CWidgetPropertyValue* displayname = widgetregistry.GetWidgetPropertyValueL(m_Uid, EBundleDisplayName );
+    if(displayname)
+        {
+        CleanupStack::PushL(displayname);
+        if(displayname->iType == EWidgetPropTypeString)
+            m_scriptSession->SetApplicationNameL(*displayname);
+        CleanupStack::PopAndDestroy(); // displayname
+        }
+    
     User::LeaveIfError(widgetregistry.Disconnect());
-    CleanupStack::PopAndDestroy(); //widgetregistry
-
-    if ( displayname && displayname->iType == EWidgetPropTypeString )
-        {
-        m_scriptSession->SetApplicationNameL(*displayname);
-        }
+    CleanupStack::PopAndDestroy(); // widgetregistry
     );
     }
 #endif