31 static const int NmProgressValueComplete = 100; |
31 static const int NmProgressValueComplete = 100; |
32 static const QString NmParamTextHeightSecondary = "hb-param-text-height-secondary"; |
32 static const QString NmParamTextHeightSecondary = "hb-param-text-height-secondary"; |
33 static const QString NmHttpLinkScheme = "http"; |
33 static const QString NmHttpLinkScheme = "http"; |
34 static const QString NmHttpsLinkScheme = "https"; |
34 static const QString NmHttpsLinkScheme = "https"; |
35 static const QString NmMailtoLinkScheme = "mailto"; |
35 static const QString NmMailtoLinkScheme = "mailto"; |
|
36 |
|
37 // Local constants |
|
38 const qreal NmZoomFactor = 1.5; |
36 |
39 |
37 /*! |
40 /*! |
38 \class NmViewerView |
41 \class NmViewerView |
39 \brief Mail viewer class |
42 \brief Mail viewer class |
40 */ |
43 */ |
192 if (mWebView) { |
195 if (mWebView) { |
193 // Set auto load images and private browsing(no history) attributes |
196 // Set auto load images and private browsing(no history) attributes |
194 QWebSettings *settings = mWebView->settings(); |
197 QWebSettings *settings = mWebView->settings(); |
195 if (settings) { |
198 if (settings) { |
196 settings->setAttribute(QWebSettings::AutoLoadImages, true); |
199 settings->setAttribute(QWebSettings::AutoLoadImages, true); |
197 settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, true); |
200 settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, true); |
198 } |
201 } |
199 QWebPage *page = mWebView->page(); |
202 QWebPage *page = mWebView->page(); |
200 if (page) { |
203 if (page) { |
201 QWebFrame *frame = page->mainFrame(); |
204 QWebFrame *frame = page->mainFrame(); |
202 if (frame) { |
205 if (frame) { |
203 frame->setScrollBarPolicy(Qt::Vertical,Qt::ScrollBarAlwaysOff); |
206 frame->setScrollBarPolicy(Qt::Vertical,Qt::ScrollBarAlwaysOff); |
204 frame->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff); |
207 frame->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff); |
|
208 frame->setTextSizeMultiplier(NmZoomFactor); |
205 connect(mWebView->page()->mainFrame(), |
209 connect(mWebView->page()->mainFrame(), |
206 SIGNAL(contentsSizeChanged(const QSize&)), |
210 SIGNAL(contentsSizeChanged(const QSize&)), |
207 this, SLOT(scaleWebViewWhenLoading(const QSize&))); |
211 this, SLOT(scaleWebViewWhenLoading(const QSize&))); |
208 } |
212 } |
209 } |
213 } |
700 void NmViewerView::scaleWebViewWhenLoaded() |
704 void NmViewerView::scaleWebViewWhenLoaded() |
701 { |
705 { |
702 QRectF myGeometry = geometry(); |
706 QRectF myGeometry = geometry(); |
703 QWebPage *page = mWebView->page(); |
707 QWebPage *page = mWebView->page(); |
704 if (mWebView && page) { |
708 if (mWebView && page) { |
705 page->setViewportSize(myGeometry.size().toSize()); |
709 page->setPreferredContentsSize(myGeometry.size().toSize()); |
706 QSizeF contentSize = page->mainFrame()->contentsSize(); |
710 QSizeF contentSize = page->mainFrame()->contentsSize(); |
707 int width = (int)contentSize.width(); |
711 mWebView->setPreferredSize(contentSize); |
708 int height = (int)contentSize.height(); |
|
709 mWebView->setPreferredWidth(width); |
|
710 mWebView->setPreferredHeight(height); |
|
711 } |
712 } |
712 } |
713 } |
713 |
714 |
714 /*! |
715 /*! |
715 Set new dimensions after orientation change. |
716 Set new dimensions after orientation change. |