webengine/widgetengine/src/WidgetFuncs.cpp
changeset 13 10e98eab6f85
parent 0 dd21522fd290
equal deleted inserted replaced
8:7c90e6132015 13:10e98eab6f85
    98             if ( !args[0]->isNull() &&
    98             if ( !args[0]->isNull() &&
    99                 (args[0]->type() == StringType || args[0]->type() == NumberType) &&
    99                 (args[0]->type() == StringType || args[0]->type() == NumberType) &&
   100                 args[0]->toString(exec).size() >= 0 ) {
   100                 args[0]->toString(exec).size() >= 0 ) {
   101                 
   101                 
   102                 TPtrC tstrKey(KNullDesC);
   102                 TPtrC tstrKey(KNullDesC);
   103                 TPtrC tstrValue(KNullDesC);
   103                 HBufC* tstrValue(NULL);
   104                 TInt retCode = KErrNone;
   104                 TInt retCode = KErrNone;
   105 
   105 
   106                 if ( args[0]->type() == NumberType ) {
   106                 if ( args[0]->type() == NumberType ) {
   107                     TBuf<INTBUFSIZE> intKey;
   107                     TBuf<INTBUFSIZE> intKey;
   108                     intKey.Num( args[0]->toNumber(exec) );
   108                     intKey.Num( args[0]->toNumber(exec) );
   113                     retCode = m_callbacks->preferenceForKey(tstrKey,tstrValue);
   113                     retCode = m_callbacks->preferenceForKey(tstrKey,tstrValue);
   114                 }
   114                 }
   115 
   115 
   116 
   116 
   117                 if (retCode == KErrNone) {
   117                 if (retCode == KErrNone) {
   118                     return jsString(UString((const UChar *)tstrValue.Ptr(),tstrValue.Length()));
   118                     UString u((const UChar *)tstrValue->Ptr(),tstrValue->Length());
       
   119                     JSCell* rtn=jsString(u);
       
   120                     delete tstrValue;
       
   121                     return rtn;
       
   122                 }
       
   123                 else {
       
   124                     delete tstrValue;
   119                 }
   125                 }
   120 
   126 
   121         }
   127         }
   122         break;
   128         break;
   123         }
   129         }
   173             if ( args[0]->type() == BooleanType ) {
   179             if ( args[0]->type() == BooleanType ) {
   174                 m_callbacks->setNavigationEnabled(args[0]->toBoolean(exec));
   180                 m_callbacks->setNavigationEnabled(args[0]->toBoolean(exec));
   175             }
   181             }
   176         break;
   182         break;
   177         }
   183         }
       
   184         case setNavigationType: {
       
   185             if (  args[0]->type() == StringType && args[0]->toString(exec).size() > 0 ) {
       
   186                 TPtrC type((const TUint16 *)args[0]->toString(exec).data(), args[0]->toString(exec).size());
       
   187                 m_callbacks->setNavigationType(type);
       
   188             }
       
   189         break;
       
   190         }
   178         case setDisplayLandscape: {
   191         case setDisplayLandscape: {
   179             m_callbacks->setDisplayLandscape();
   192             m_callbacks->setDisplayLandscape();
   180         break;
   193         break;
   181         }
   194         }
   182         case setDisplayPortrait: {
   195         case setDisplayPortrait: {