equal
deleted
inserted
replaced
49 #include "TitleBar.h" |
49 #include "TitleBar.h" |
50 #include "flickcharm.h" |
50 #include "flickcharm.h" |
51 #include "webview.h" |
51 #include "webview.h" |
52 #include "ZoomStrip.h" |
52 #include "ZoomStrip.h" |
53 |
53 |
54 #if defined (Q_OS_SYMBIAN) |
|
55 #include "sym_iap_util.h" |
|
56 #endif |
|
57 |
|
58 BrowserView::BrowserView(QWidget *parent) |
54 BrowserView::BrowserView(QWidget *parent) |
59 : QWidget(parent) |
55 : QWidget(parent) |
60 , m_titleBar(0) |
56 , m_titleBar(0) |
61 , m_webView(0) |
57 , m_webView(0) |
62 , m_progress(0) |
58 , m_progress(0) |
68 m_controlStrip = new ControlStrip(this); |
64 m_controlStrip = new ControlStrip(this); |
69 |
65 |
70 m_zoomLevels << 30 << 50 << 67 << 80 << 90; |
66 m_zoomLevels << 30 << 50 << 67 << 80 << 90; |
71 m_zoomLevels << 100; |
67 m_zoomLevels << 100; |
72 m_zoomLevels << 110 << 120 << 133 << 150 << 170 << 200 << 240 << 300; |
68 m_zoomLevels << 110 << 120 << 133 << 150 << 170 << 200 << 240 << 300; |
|
69 |
|
70 QNetworkConfigurationManager manager; |
|
71 if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) { |
|
72 // Get saved network configuration |
|
73 QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); |
|
74 settings.beginGroup(QLatin1String("QtNetwork")); |
|
75 const QString id = |
|
76 settings.value(QLatin1String("DefaultNetworkConfiguration")).toString(); |
|
77 settings.endGroup(); |
|
78 |
|
79 // If the saved network configuration is not currently discovered use the system |
|
80 // default |
|
81 QNetworkConfiguration config = manager.configurationFromIdentifier(id); |
|
82 if ((config.state() & QNetworkConfiguration::Discovered) != |
|
83 QNetworkConfiguration::Discovered) { |
|
84 config = manager.defaultConfiguration(); |
|
85 } |
|
86 |
|
87 m_webView->page()->networkAccessManager()->setConfiguration(config); |
|
88 } |
73 |
89 |
74 QTimer::singleShot(0, this, SLOT(initialize())); |
90 QTimer::singleShot(0, this, SLOT(initialize())); |
75 } |
91 } |
76 |
92 |
77 void BrowserView::initialize() |
93 void BrowserView::initialize() |
98 connect(m_webView, SIGNAL(urlChanged(QUrl)), SLOT(updateTitleBar())); |
114 connect(m_webView, SIGNAL(urlChanged(QUrl)), SLOT(updateTitleBar())); |
99 |
115 |
100 m_webView->setHtml("about:blank"); |
116 m_webView->setHtml("about:blank"); |
101 m_webView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
117 m_webView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
102 m_webView->setFocus(); |
118 m_webView->setFocus(); |
103 #ifdef Q_OS_SYMBIAN |
|
104 QTimer::singleShot(0, this, SLOT(setDefaultIap())); |
|
105 #endif |
|
106 } |
119 } |
107 |
120 |
108 void BrowserView::start() |
121 void BrowserView::start() |
109 { |
122 { |
110 m_progress = 0; |
123 m_progress = 0; |
171 |
184 |
172 int zw = m_zoomStrip->sizeHint().width(); |
185 int zw = m_zoomStrip->sizeHint().width(); |
173 int zh = m_zoomStrip->sizeHint().height(); |
186 int zh = m_zoomStrip->sizeHint().height(); |
174 m_zoomStrip->move(width() - zw, (height() - zh) / 2); |
187 m_zoomStrip->move(width() - zw, (height() - zh) / 2); |
175 } |
188 } |
176 #ifdef Q_OS_SYMBIAN |
|
177 void BrowserView::setDefaultIap() |
|
178 { |
|
179 qt_SetDefaultIap(); |
|
180 m_webView->load(QUrl("http://news.bbc.co.uk/text_only.stm")); |
|
181 } |
|
182 #endif |
|
183 |
189 |
184 void BrowserView::navigate(const QUrl &url) |
190 void BrowserView::navigate(const QUrl &url) |
185 { |
191 { |
186 m_webView->load(url); |
192 m_webView->load(url); |
187 } |
193 } |