webengine/osswebengine/WebKit/s60/misc/WebUtil.cpp
changeset 5 10e98eab6f85
parent 1 7c90e6132015
child 10 a359256acfc6
equal deleted inserted replaced
1:7c90e6132015 5:10e98eab6f85
   254     Frame* f = core(&wf_);
   254     Frame* f = core(&wf_);
   255 
   255 
   256     if (!f || !f->document() || !f->document()->renderer())
   256     if (!f || !f->document() || !f->document()->renderer())
   257         return imglist;
   257         return imglist;
   258 
   258 
   259     CleanupStack::PushL(imglist);
       
   260 
       
   261     Document* doc = f->document();
   259     Document* doc = f->document();
   262     FrameView* v = doc->view();
   260     FrameView* v = doc->view();
   263     IntRect r1 = wf_.frameView()->topView()->mainFrame()->frameView()->rect();
   261     IntRect r1 = wf_.frameView()->topView()->mainFrame()->frameView()->rect();
   264 
   262 
   265 
   263 
   306                                       break;
   304                                       break;
   307                               }
   305                               }
   308 
   306 
   309                         }
   307                         }
   310                         if (!imgexists)
   308                         if (!imgexists)
   311                             imglist->AppendL(tImg);
   309                             TRAP_IGNORE( imglist->AppendL(tImg) );
   312                     }
   310                     }
   313                 }
   311                 }
   314             }
   312             }
   315         }
   313         }
   316     }
   314     }
   317     CleanupStack::Pop(imglist);
       
   318     return imglist;
   315     return imglist;
   319 }
   316 }
   320 
   317 
   321 CArrayFixFlat<TBrCtlSubscribeTo>* findSubscribeToInFrame(WebFrame& wf_)
   318 CArrayFixFlat<TBrCtlSubscribeTo>* findSubscribeToInFrame(WebFrame& wf_)
   322 {
   319 {
   324     Frame* f = core(&wf_);
   321     Frame* f = core(&wf_);
   325 
   322 
   326     if (!f || !f->document())
   323     if (!f || !f->document())
   327         return linkList;
   324         return linkList;
   328 
   325 
   329     CleanupStack::PushL(linkList);
       
   330     for (Node *n = f->document(); n; n = n->traverseNextNode()) {
   326     for (Node *n = f->document(); n; n = n->traverseNextNode()) {
   331         if (n->isElementNode() && n->hasTagName(linkTag)) {
   327         if (n->isElementNode() && n->hasTagName(linkTag)) {
   332 
   328 
   333             HTMLElement* e =  static_cast<HTMLElement*>(n);
   329             HTMLElement* e =  static_cast<HTMLElement*>(n);
   334             String type = e->getAttribute(typeAttr);
   330             String type = e->getAttribute(typeAttr);
   337                 type == "text/xml" || type == "application/xml") {
   333                 type == "text/xml" || type == "application/xml") {
   338                 String href = e->getAttribute(hrefAttr);
   334                 String href = e->getAttribute(hrefAttr);
   339                 String title = e->getAttribute(titleAttr);
   335                 String title = e->getAttribute(titleAttr);
   340 
   336 
   341                 TBrCtlSubscribeTo item(title.des(), href.des(), 0);
   337                 TBrCtlSubscribeTo item(title.des(), href.des(), 0);
   342                 linkList->AppendL(item);
   338                 TRAP_IGNORE( linkList->AppendL(item) );
   343             }
   339             }
   344         }
   340         }
   345     }
   341     }
   346     CleanupStack::Pop(linkList);
       
   347     return linkList;
   342     return linkList;
   348 }
   343 }
   349 
   344 
   350 int focusedImage(WebView* webView, TBrCtlImageCarrier*& imageCarrier)
   345 int focusedImage(WebView* webView, TBrCtlImageCarrier*& imageCarrier)
   351 {
   346 {
   465 
   460 
   466 
   461 
   467 void addOneMenuItemAfter(CEikMenuPane& menuPane, unsigned int after, int command, int resourceId, unsigned int commandBase)
   462 void addOneMenuItemAfter(CEikMenuPane& menuPane, unsigned int after, int command, int resourceId, unsigned int commandBase)
   468 {
   463 {
   469     CEikMenuPaneItem::SData item;
   464     CEikMenuPaneItem::SData item;
   470     HBufC* buf = StringLoader::LoadLC(resourceId);
   465     HBufC* buf = NULL;
       
   466     TRAP_IGNORE( buf = StringLoader::LoadL(resourceId));
       
   467     if(buf == NULL)
       
   468         {
       
   469         return;
       
   470         }
   471     item.iText.Copy(*buf);
   471     item.iText.Copy(*buf);
   472     CleanupStack::PopAndDestroy();  // buf
   472     delete buf;
   473     buf = NULL;
   473     buf = NULL;
   474     item.iCommandId = command + commandBase;
   474     item.iCommandId = command + commandBase;
   475     item.iFlags = 0;
   475     item.iFlags = 0;
   476     item.iCascadeId = 0;
   476     item.iCascadeId = 0;
   477     menuPane.AddMenuItemL(item, after);
   477     TRAP_IGNORE( menuPane.AddMenuItemL(item, after) );
   478 }
   478 }
   479 
   479 
   480 void insertOneMenuItem(CEikMenuPane& menuPane, int command, int resourceId, unsigned int commandBase)
   480 void insertOneMenuItem(CEikMenuPane& menuPane, int command, int resourceId, unsigned int commandBase)
   481 {
   481 {
   482     CEikMenuPaneItem::SData item;
   482     CEikMenuPaneItem::SData item;
   483     HBufC* buf = StringLoader::LoadLC(resourceId);
   483     HBufC* buf = NULL;
       
   484     TRAP_IGNORE( buf = StringLoader::LoadL(resourceId));
       
   485     if(buf == NULL)
       
   486         {
       
   487         return;
       
   488         }
   484     item.iText.Copy(*buf);
   489     item.iText.Copy(*buf);
   485     CleanupStack::PopAndDestroy();  // buf
   490     delete buf;
   486     buf = NULL;
   491     buf = NULL;
   487     item.iCommandId = command + commandBase;
   492     item.iCommandId = command + commandBase;
   488     item.iFlags = 0;
   493     item.iFlags = 0;
   489     item.iCascadeId = 0;
   494     item.iCascadeId = 0;
   490     menuPane.InsertMenuItemL(item, 0);
   495     TRAP_IGNORE( menuPane.InsertMenuItemL(item, 0) );
   491 }
   496 }
   492 
   497 
   493 int textMultiplier(int fontLevel, int originalSize)
   498 int textMultiplier(int fontLevel, int originalSize)
   494 {
   499 {
   495     int sizeMultiplier = originalSize;
   500     int sizeMultiplier = originalSize;
   599                         url.append(tel);
   604                         url.append(tel);
   600                         url.append(numberNameSeparator);
   605                         url.append(numberNameSeparator);
   601                         url.append(telbook);
   606                         url.append(telbook);
   602                         url.append(numberNameSeparator);
   607                         url.append(numberNameSeparator);
   603                         url.append(email);
   608                         url.append(email);
   604                         handleSpecialSchemeL(url, webView->brCtl());
   609                         TRAP_IGNORE( handleSpecialSchemeL(url, webView->brCtl()) );
   605                     }
   610                     }
   606                 }
   611                 }
   607             }
   612             }
   608         }
   613         }
   609     }
   614     }