void QWebFrameProto::setTextSizeMultiplier(qreal factor) { scriptDeprecated("QWebFrame will not be available in future versions"); QWebFrame *item = qscriptvalue_cast<QWebFrame*>(thisObject()); if (item) item->setTextSizeMultiplier(factor); }
/*! View layout loading from XML */ void NmViewerView::loadViewLayout() { NM_FUNCTION; // Use document loader to load the view bool ok(false); setObjectName(QString(NMUI_MESSAGE_VIEWER_VIEW)); QObjectList objectList; objectList.append(this); // Pass the view to documentloader. Document loader uses this view // when docml is parsed, instead of creating new view. // documentloader is created in constructor mDocumentLoader->setObjectTree(objectList); mWidgetList = mDocumentLoader->load(NMUI_MESSAGE_VIEWER_XML, &ok); if (ok) { // Create content and content layout // qobject_cast not work in this case, using reinterpret_cast mViewerContent = reinterpret_cast<HbWidget *>( mDocumentLoader->findObject(NMUI_MESSAGE_VIEWER_CONTENT)); // Find scroll area mScrollArea = reinterpret_cast<HbScrollArea *>( mDocumentLoader->findObject(NMUI_MESSAGE_VIEWER_SCROLL_AREA)); if (mScrollArea) { mScrollArea->setParentItem(this); mScrollArea->setScrollDirections(Qt::Vertical | Qt::Horizontal); connect(mScrollArea, SIGNAL(scrollPositionChanged(QPointF)), this, SLOT(contentScrollPositionChanged(QPointF))); // Get scroll area contents and set layout margins mScrollAreaContents = qobject_cast<HbWidget *>( mDocumentLoader->findObject(NMUI_MESSAGE_VIEWER_SCROLL_AREA_CONTENTS)); if (mScrollAreaContents) { QGraphicsLayout *layout = mScrollAreaContents->layout(); if (layout){ layout->setContentsMargins(0,0,0,0); } // Set white pixmap to backgrounditem QPixmap whitePixmap(NmWhitePixmapSize,NmWhitePixmapSize); whitePixmap.fill(Qt::white); QGraphicsPixmapItem *pixmapItem = new QGraphicsPixmapItem(whitePixmap); mScrollAreaContents->setBackgroundItem(pixmapItem); } // Load headerwidget mHeaderWidget = qobject_cast<NmViewerHeader *>( mDocumentLoader->findObject(NMUI_MESSAGE_VIEWER_HEADER)); if (mHeaderWidget) { mHeaderWidget->setView(this); mHeaderWidget->rescaleHeader(mScreenSize); mHeaderWidget->setMessage(mMessage); QPointF headerStartPos = mHeaderWidget->scenePos(); mHeaderStartScenePos = QPointF(0,headerStartPos.y()); } // Load webview mWebView = reinterpret_cast<NmMailViewerWK *>( mDocumentLoader->findObject(QString(NMUI_MESSAGE_VIEWER_SCROLL_WEB_VIEW))); if (mWebView) { // Set auto load images and private browsing(no history) attributes QWebSettings *settings = mWebView->settings(); if (settings) { settings->setAttribute(QWebSettings::AutoLoadImages, true); settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, true); } QWebPage *page = mWebView->page(); if (page) { QWebFrame *frame = page->mainFrame(); if (frame) { frame->setScrollBarPolicy(Qt::Vertical,Qt::ScrollBarAlwaysOff); frame->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff); frame->setTextSizeMultiplier(NmZoomFactor); connect(mWebView->page()->mainFrame(), SIGNAL(contentsSizeChanged(const QSize&)), this, SLOT(scaleWebViewWhenLoading(const QSize&))); } } } } } }