128 } |
126 } |
129 |
127 |
130 delete mCellularIndicator; |
128 delete mCellularIndicator; |
131 delete mWlanIndicator; |
129 delete mWlanIndicator; |
132 |
130 |
133 OstTrace0(TRACE_FLOW, INDICATOROBSERVER_DESTRUCTOR_EXIT, "<--"); |
131 OstTraceFunctionExit0(INDICATOROBSERVER_DESTRUCTOR_EXIT); |
134 } |
132 } |
135 |
133 |
136 /*! |
134 /*! |
137 IndicatorObserver::initializeIndicators |
135 IndicatorObserver::initializeIndicators |
138 */ |
136 */ |
139 void IndicatorObserver::initializeIndicators() |
137 void IndicatorObserver::initializeIndicators() |
140 { |
138 { |
141 |
139 |
142 OstTrace0(TRACE_FLOW, INDICATOROBSERVER_INITIALIZEINDICATORS_ENTRY, "-->"); |
140 OstTraceFunctionEntry0(INDICATOROBSERVER_INITIALIZEINDICATORS_ENTRY); |
143 |
141 |
144 // create the indicators and make connections |
142 // create the indicators and make connections |
145 mCellularIndicator = new HbIndicator(); |
143 mCellularIndicator = new HbIndicator(); |
146 // connect the user activated slot here, so that the indicator know to start the connview in case |
144 // connect the user activated slot here, so that the indicator know to start the connview in case |
147 // the user taps the indicator |
145 // the user taps the indicator |
162 |
160 |
163 findActiveConfigurations(); |
161 findActiveConfigurations(); |
164 updateWlanIndicator(); |
162 updateWlanIndicator(); |
165 updateCellularIndicator(); |
163 updateCellularIndicator(); |
166 |
164 |
167 OstTrace0(TRACE_FLOW, INDICATOROBSERVER_INITIALIZEINDICATORS_EXIT, "<--"); |
165 OstTraceFunctionExit0(INDICATOROBSERVER_INITIALIZEINDICATORS_EXIT); |
168 } |
166 } |
169 |
167 |
170 /*! |
168 /*! |
171 IndicatorObserver::updateWlanRadioStatus |
169 IndicatorObserver::updateWlanRadioStatus |
172 */ |
170 */ |
173 void IndicatorObserver::updateWlanRadioStatus(const XQSettingsKey &key, const QVariant &value) |
171 void IndicatorObserver::updateWlanRadioStatus(const XQSettingsKey &key, const QVariant &value) |
174 { |
172 { |
175 OstTrace0(TRACE_FLOW, INDICATOROBSERVER_UPDATEWLANRADIOSTATUS_ENTRY, "-->"); |
173 OstTraceFunctionEntry0(INDICATOROBSERVER_UPDATEWLANRADIOSTATUS_ENTRY); |
176 |
174 |
177 // The change notification is received either for the WlanOnoff key, or the |
175 // The change notification is received either for the WlanOnoff key, or the |
178 // ForceDisableWlan key |
176 // ForceDisableWlan key |
179 if (KWlanOnOff == key.key()) { |
177 if (KWlanOnOff == key.key()) { |
180 mWlanEnabled = value.toInt() ? true : false; |
178 mWlanEnabled = value.toInt() ? true : false; |
185 if (mWlanEnabled == false || mWlanForceDisabled == true) { |
183 if (mWlanEnabled == false || mWlanForceDisabled == true) { |
186 deactivateWlanIndicatorPlugin(); |
184 deactivateWlanIndicatorPlugin(); |
187 } else { |
185 } else { |
188 updateWlanIndicator(); |
186 updateWlanIndicator(); |
189 } |
187 } |
190 OstTrace0(TRACE_FLOW, INDICATOROBSERVER_UPDATEWLANRADIOSTATUS_EXIT, "<--"); |
188 OstTraceFunctionExit0(INDICATOROBSERVER_UPDATEWLANRADIOSTATUS_EXIT); |
191 } |
189 } |
192 |
190 |
193 /*! |
191 /*! |
194 IndicatorObserver::findActiveConfigurations |
192 IndicatorObserver::findActiveConfigurations |
195 */ |
193 */ |
196 void IndicatorObserver::findActiveConfigurations() |
194 void IndicatorObserver::findActiveConfigurations() |
197 { |
195 { |
198 OstTrace0(TRACE_FLOW, INDICATOROBSERVER_FINDACTIVECONFIGURATIONS_ENTRY, "-->"); |
196 OstTraceFunctionEntry0(INDICATOROBSERVER_FINDACTIVECONFIGURATIONS_ENTRY); |
199 |
197 |
200 mActiveWlanConfigurations->clear(); |
198 mActiveWlanConfigurations->clear(); |
201 mActiveCellularConfigurations->clear(); |
199 mActiveCellularConfigurations->clear(); |
202 |
200 |
203 //Let's find active connections if any |
201 //Let's find active connections if any |
242 list.insert(0, wlanConnected); |
240 list.insert(0, wlanConnected); |
243 list.insert(1, mActiveWlanConfigurations->at(0).name()); |
241 list.insert(1, mActiveWlanConfigurations->at(0).name()); |
244 activateWlanIndicatorPlugin(list); |
242 activateWlanIndicatorPlugin(list); |
245 } |
243 } |
246 } |
244 } |
247 OstTrace0(TRACE_FLOW, INDICATOROBSERVER_UPDATEWLANINDICATOR_EXIT, "<--"); |
245 OstTraceFunctionExit0(INDICATOROBSERVER_UPDATEWLANINDICATOR_EXIT); |
248 } |
246 } |
249 |
247 |
250 /*! |
248 /*! |
251 IndicatorObserver::updateCellularIndicator |
249 IndicatorObserver::updateCellularIndicator |
252 */ |
250 */ |
253 void IndicatorObserver::updateCellularIndicator() |
251 void IndicatorObserver::updateCellularIndicator() |
254 { |
252 { |
255 OstTrace0(TRACE_FLOW, INDICATOROBSERVER_UPDATECELLULARINDICATOR_ENTRY, "-->"); |
253 OstTraceFunctionEntry0(INDICATOROBSERVER_UPDATECELLULARINDICATOR_ENTRY); |
256 |
254 |
257 QList<QVariant> list; |
255 QList<QVariant> list; |
258 |
256 |
259 int count = mActiveCellularConfigurations->count(); |
257 int count = mActiveCellularConfigurations->count(); |
260 |
258 |
271 list.insert(0, count); |
269 list.insert(0, count); |
272 |
270 |
273 } |
271 } |
274 activateCellularIndicatorPlugin(list); |
272 activateCellularIndicatorPlugin(list); |
275 } |
273 } |
276 OstTrace0(TRACE_FLOW, INDICATOROBSERVER_UPDATECELLULARINDICATOR_EXIT, "<--"); |
274 OstTraceFunctionExit0(INDICATOROBSERVER_UPDATECELLULARINDICATOR_EXIT); |
277 } |
275 } |
278 |
276 |
279 /*! |
277 /*! |
280 IndicatorObserver::handleConfigurationChanged |
278 IndicatorObserver::handleConfigurationChanged |
281 */ |
279 */ |
282 void IndicatorObserver::handleConfigurationChanged(const QNetworkConfiguration& config) |
280 void IndicatorObserver::handleConfigurationChanged(const QNetworkConfiguration& config) |
283 { |
281 { |
284 OstTrace0(TRACE_FLOW, INDICATOROBSERVER_HANDLECONFIGURATIONCHANGED_ENTRY, "-->"); |
282 OstTraceFunctionEntry0(INDICATOROBSERVER_HANDLECONFIGURATIONCHANGED_ENTRY); |
285 |
283 |
286 switch (config.state()) |
284 switch (config.state()) |
287 { |
285 { |
288 case QNetworkConfiguration::Defined: //To handle situation where we have active connection and it is lost due to bad radio conditions |
286 case QNetworkConfiguration::Defined: //To handle situation where we have active connection and it is lost due to bad radio conditions |
289 case QNetworkConfiguration::Discovered: |
287 case QNetworkConfiguration::Discovered: |
305 break; |
303 break; |
306 |
304 |
307 default: |
305 default: |
308 break; |
306 break; |
309 } |
307 } |
310 OstTrace0(TRACE_FLOW, INDICATOROBSERVER_HANDLECONFIGURATIONCHANGED_EXIT, "<--"); |
308 OstTraceFunctionExit0(INDICATOROBSERVER_HANDLECONFIGURATIONCHANGED_EXIT); |
311 } |
309 } |
312 |
310 |
313 void IndicatorObserver::userActivateCellularIndicator(const QString &type, const QVariantMap &data) |
311 void IndicatorObserver::userActivateCellularIndicator(const QString &type, const QVariantMap &data) |
314 { |
312 { |
315 OstTrace0(TRACE_FLOW, INDICATOROBSERVER_USERACTIVATECELLULARINDICATOR_ENTRY, "-->"); |
313 OstTraceFunctionEntry0(INDICATOROBSERVER_USERACTIVATECELLULARINDICATOR_ENTRY); |
316 |
314 |
317 Q_UNUSED(data); |
315 Q_UNUSED(data); |
318 Q_UNUSED(type); |
316 Q_UNUSED(type); |
319 // Show connection view |
317 // Show connection view |
320 QProcess::startDetached("connview"); |
318 QProcess::startDetached("connview"); |
321 |
319 |
322 OstTrace0(TRACE_FLOW, INDICATOROBSERVER_USERACTIVATECELLULARINDICATOR_EXIT, "<--"); |
320 OstTraceFunctionExit0(INDICATOROBSERVER_USERACTIVATECELLULARINDICATOR_EXIT); |
323 } |
321 } |
324 |
322 |
325 void IndicatorObserver::userActivateWlanIndicator(const QString &type, const QVariantMap &data) |
323 void IndicatorObserver::userActivateWlanIndicator(const QString &type, const QVariantMap &data) |
326 { |
324 { |
327 OstTrace0(TRACE_FLOW, INDICATOROBSERVER_USERACTIVATEWLANINDICATOR_ENTRY, "-->"); |
325 OstTraceFunctionEntry0(INDICATOROBSERVER_USERACTIVATEWLANINDICATOR_ENTRY); |
328 |
326 |
329 Q_UNUSED(data); |
327 Q_UNUSED(data); |
330 Q_UNUSED(type); |
328 Q_UNUSED(type); |
331 // Show wlan list view |
329 // Show wlan list view |
332 QProcess::startDetached("WlanSniffer"); |
330 QProcess::startDetached("WlanSniffer"); |
333 |
331 |
334 OstTrace0(TRACE_FLOW, INDICATOROBSERVER_USERACTIVATEWLANINDICATOR_EXIT, "<--"); |
332 OstTraceFunctionExit0(INDICATOROBSERVER_USERACTIVATEWLANINDICATOR_EXIT); |
335 } |
333 } |
336 |
334 |
337 /*! |
335 /*! |
338 IndicatorObserver::activateCellularIndicatorPlugin |
336 IndicatorObserver::activateCellularIndicatorPlugin |
339 */ |
337 */ |
340 void IndicatorObserver::activateCellularIndicatorPlugin(QList<QVariant> list) |
338 void IndicatorObserver::activateCellularIndicatorPlugin(QList<QVariant> list) |
341 { |
339 { |
342 OstTrace0(TRACE_FLOW, INDICATOROBSERVER_ACTIVATECELLULARINDICATORPLUGIN_ENTRY, "-->"); |
340 OstTraceFunctionEntry0(INDICATOROBSERVER_ACTIVATECELLULARINDICATORPLUGIN_ENTRY); |
343 |
341 |
344 bool success = mCellularIndicator->activate("com.nokia.hb.indicator.connectivity.cellularindicatorplugin/1.0", list); |
342 bool success = mCellularIndicator->activate("com.nokia.hb.indicator.connectivity.cellularindicatorplugin/1.0", list); |
345 |
343 |
346 if (!success) { |
344 if (!success) { |
347 mCellularIndicatorIsActivated = false; |
345 mCellularIndicatorIsActivated = false; |
348 OstTrace0(TRACE_FLOW, INDICATOROBSERVER_CELLULAR_INDICATOR_ACTIVATION_FAILED, "Cellular indicator activation failed"); |
346 OstTrace0(TRACE_FLOW, INDICATOROBSERVER_CELLULAR_INDICATOR_ACTIVATION_FAILED, "Cellular indicator activation failed"); |
349 } else { |
347 } else { |
350 mCellularIndicatorIsActivated = true; |
348 mCellularIndicatorIsActivated = true; |
351 } |
349 } |
352 |
350 |
353 OstTrace0(TRACE_FLOW, INDICATOROBSERVER_ACTIVATECELLULARINDICATORPLUGIN_EXIT, "<--"); |
351 OstTraceFunctionExit0(INDICATOROBSERVER_ACTIVATECELLULARINDICATORPLUGIN_EXIT); |
354 } |
352 } |
355 |
353 |
356 /*! |
354 /*! |
357 IndicatorObserver::deactivateCellularIndicatorPlugin |
355 IndicatorObserver::deactivateCellularIndicatorPlugin |
358 */ |
356 */ |
359 void IndicatorObserver::deactivateCellularIndicatorPlugin() |
357 void IndicatorObserver::deactivateCellularIndicatorPlugin() |
360 { |
358 { |
361 OstTrace0(TRACE_FLOW, INDICATOROBSERVER_DEACTIVATECELLULARINDICATORPLUGIN_ENTRY, "-->"); |
359 OstTraceFunctionEntry0(INDICATOROBSERVER_DEACTIVATECELLULARINDICATORPLUGIN_ENTRY); |
362 |
360 |
363 mCellularIndicator->deactivate("com.nokia.hb.indicator.connectivity.cellularindicatorplugin/1.0"); |
361 mCellularIndicator->deactivate("com.nokia.hb.indicator.connectivity.cellularindicatorplugin/1.0"); |
364 mCellularIndicatorIsActivated = false; |
362 mCellularIndicatorIsActivated = false; |
365 |
363 |
366 OstTrace0(TRACE_FLOW, INDICATOROBSERVER_DEACTIVATECELLULARINDICATORPLUGIN_EXIT, "<--"); |
364 OstTraceFunctionExit0(INDICATOROBSERVER_DEACTIVATECELLULARINDICATORPLUGIN_EXIT); |
367 } |
365 } |
368 |
366 |
369 /*! |
367 /*! |
370 IndicatorObserver::activateWlanIndicatorPlugin |
368 IndicatorObserver::activateWlanIndicatorPlugin |
371 */ |
369 */ |
372 void IndicatorObserver::activateWlanIndicatorPlugin(QList<QVariant> list) |
370 void IndicatorObserver::activateWlanIndicatorPlugin(QList<QVariant> list) |
373 { |
371 { |
374 OstTrace0(TRACE_FLOW, INDICATOROBSERVER_ACTIVATEWLANINDICATORPLUGIN_ENTRY, "-->"); |
372 OstTraceFunctionEntry0(INDICATOROBSERVER_ACTIVATEWLANINDICATORPLUGIN_ENTRY); |
375 |
373 |
376 bool success = mWlanIndicator->activate("com.nokia.hb.indicator.connectivity.wlanindicatorplugin/1.0", list); |
374 bool success = mWlanIndicator->activate("com.nokia.hb.indicator.connectivity.wlanindicatorplugin/1.0", list); |
377 |
375 |
378 if (!success) { |
376 if (!success) { |
379 mWlanIndicatorIsActivated = false; |
377 mWlanIndicatorIsActivated = false; |
380 OstTrace0(TRACE_FLOW, INDICATOROBSERVER_WLAN_INDICATOR_ACTIVATION_FAILED, "WLAN indicator activation failed"); |
378 OstTrace0(TRACE_FLOW, INDICATOROBSERVER_WLAN_INDICATOR_ACTIVATION_FAILED, "WLAN indicator activation failed"); |
381 } else { |
379 } else { |
382 mWlanIndicatorIsActivated = true; |
380 mWlanIndicatorIsActivated = true; |
383 } |
381 } |
384 |
382 |
385 OstTrace0(TRACE_FLOW, INDICATOROBSERVER_ACTIVATEWLANINDICATORPLUGIN_EXIT, "<--"); |
383 OstTraceFunctionExit0(INDICATOROBSERVER_ACTIVATEWLANINDICATORPLUGIN_EXIT); |
386 } |
384 } |
387 |
385 |
388 /*! |
386 /*! |
389 IndicatorObserver::deactivateWlanIndicatorPlugin |
387 IndicatorObserver::deactivateWlanIndicatorPlugin |
390 */ |
388 */ |
391 void IndicatorObserver::deactivateWlanIndicatorPlugin() |
389 void IndicatorObserver::deactivateWlanIndicatorPlugin() |
392 { |
390 { |
393 OstTrace0(TRACE_FLOW, INDICATOROBSERVER_DEACTIVATEWLANINDICATORPLUGIN_ENTRY, "-->"); |
391 OstTraceFunctionEntry0(INDICATOROBSERVER_DEACTIVATEWLANINDICATORPLUGIN_ENTRY); |
394 |
392 |
395 mWlanIndicator->deactivate("com.nokia.hb.indicator.connectivity.wlanindicatorplugin/1.0"); |
393 mWlanIndicator->deactivate("com.nokia.hb.indicator.connectivity.wlanindicatorplugin/1.0"); |
396 mWlanIndicatorIsActivated = false; |
394 mWlanIndicatorIsActivated = false; |
397 |
395 |
398 OstTrace0(TRACE_FLOW, INDICATOROBSERVER_DEACTIVATEWLANINDICATORPLUGIN_EXIT, "<--"); |
396 OstTraceFunctionExit0(INDICATOROBSERVER_DEACTIVATEWLANINDICATORPLUGIN_EXIT); |
399 } |
397 } |