309 |
309 |
310 void BtcpuiDeviceView::setDeviceStatus(int majorRole) |
310 void BtcpuiDeviceView::setDeviceStatus(int majorRole) |
311 { |
311 { |
312 BOstraceFunctionEntry1( DUMMY_DEVLIST, this ); |
312 BOstraceFunctionEntry1( DUMMY_DEVLIST, this ); |
313 QString deviceStatus; |
313 QString deviceStatus; |
|
314 bool ret = false; |
|
315 |
314 // Avoid unnecessary actions: |
316 // Avoid unnecessary actions: |
315 // The device model has been modified and need to be reflected |
317 // The device model has been modified and need to be reflected |
316 // in the UI however if we don't disable the signal before the UI update |
318 // in the UI however if we don't disable the signal before the UI update |
317 // the connectionPreferenceChanged function will be called and trigger |
319 // the connectionPreferenceChanged function will be called and trigger |
318 // unnecessary update of the model by the device view. |
320 // unnecessary update of the model by the device view. |
319 mConnectionDataForm->removeConnection(mCombobox, SIGNAL(currentIndexChanged (int)), |
321 ret = disconnect(mCombobox, SIGNAL(currentIndexChanged (int)), |
320 this, SLOT(connectionPreferenceChanged(int))); |
322 this, SLOT(connectionPreferenceChanged(int))); |
|
323 BTUI_ASSERT_X( ret, "Btui, BtcpuiDeviceView::setDeviceStatus", "currentIndexChanged() disconnect failed"); |
|
324 |
321 if (majorRole & BtuiDevProperty::Bonded && |
325 if (majorRole & BtuiDevProperty::Bonded && |
322 majorRole & BtuiDevProperty::Trusted && |
326 majorRole & BtuiDevProperty::Trusted && |
323 majorRole & BtuiDevProperty::Connected ) { |
327 majorRole & BtuiDevProperty::Connected ) { |
324 mDeviceStatus->setPlainText(hbTrId("txt_bt_info_paired_trused_connected")); |
328 mDeviceStatus->setPlainText(hbTrId("txt_bt_info_paired_trused_connected")); |
325 mCombobox->setContentWidgetData("currentIndex", ConnectionAutomatic ); |
329 mCombobox->setCurrentIndex(ConnectionAutomatic ); |
326 mComboboxIndex = ConnectionAutomatic; |
330 mComboboxIndex = ConnectionAutomatic; |
327 } |
331 } |
328 else if (majorRole & BtuiDevProperty::Bonded && |
332 else if (majorRole & BtuiDevProperty::Bonded && |
329 majorRole & BtuiDevProperty::Connected ) { |
333 majorRole & BtuiDevProperty::Connected ) { |
330 mDeviceStatus->setPlainText(hbTrId("txt_bt_info_paired_connected")); |
334 mDeviceStatus->setPlainText(hbTrId("txt_bt_info_paired_connected")); |
331 mCombobox->setContentWidgetData("currentIndex", ConnectionAlwaysAsk ); |
335 mCombobox->setCurrentIndex(ConnectionAlwaysAsk ); |
332 mComboboxIndex = ConnectionAlwaysAsk; |
336 mComboboxIndex = ConnectionAlwaysAsk; |
333 } |
337 } |
334 else if (majorRole & BtuiDevProperty::Bonded && |
338 else if (majorRole & BtuiDevProperty::Bonded && |
335 majorRole & BtuiDevProperty::Trusted ) { |
339 majorRole & BtuiDevProperty::Trusted ) { |
336 mDeviceStatus->setPlainText(hbTrId("txt_bt_info_paired_trusted")); |
340 mDeviceStatus->setPlainText(hbTrId("txt_bt_info_paired_trusted")); |
337 mCombobox->setContentWidgetData("currentIndex", ConnectionAutomatic ); |
341 mCombobox->setCurrentIndex(ConnectionAutomatic ); |
338 mComboboxIndex = ConnectionAutomatic; |
342 mComboboxIndex = ConnectionAutomatic; |
339 } |
343 } |
340 else if (majorRole & BtuiDevProperty::Connected && |
344 else if (majorRole & BtuiDevProperty::Connected && |
341 majorRole & BtuiDevProperty::Trusted ) { |
345 majorRole & BtuiDevProperty::Trusted ) { |
342 mDeviceStatus->setPlainText(hbTrId("Trusted, Connected")); // ToDo: missing textId! |
346 mDeviceStatus->setPlainText(hbTrId("Trusted, Connected")); // ToDo: missing textId! |
343 mCombobox->setContentWidgetData("currentIndex", ConnectionAutomatic ); |
347 mCombobox->setCurrentIndex(ConnectionAutomatic ); |
344 mComboboxIndex = ConnectionAutomatic; |
348 mComboboxIndex = ConnectionAutomatic; |
345 } |
349 } |
346 else if (majorRole & BtuiDevProperty::Trusted ) { |
350 else if (majorRole & BtuiDevProperty::Trusted ) { |
347 mDeviceStatus->setPlainText(hbTrId("Trusted")); // ToDo: missing textId! |
351 mDeviceStatus->setPlainText(hbTrId("Trusted")); // ToDo: missing textId! |
348 mCombobox->setContentWidgetData("currentIndex", ConnectionAutomatic ); |
352 mCombobox->setCurrentIndex(ConnectionAutomatic ); |
349 mComboboxIndex = ConnectionAutomatic; |
353 mComboboxIndex = ConnectionAutomatic; |
350 } |
354 } |
351 else if (majorRole & BtuiDevProperty::Bonded) { |
355 else if (majorRole & BtuiDevProperty::Bonded) { |
352 mDeviceStatus->setPlainText(hbTrId("txt_bt_info_paired")); |
356 mDeviceStatus->setPlainText(hbTrId("txt_bt_info_paired")); |
353 mCombobox->setContentWidgetData("currentIndex", ConnectionAlwaysAsk ); |
357 mCombobox->setCurrentIndex(ConnectionAlwaysAsk ); |
354 mComboboxIndex = ConnectionAlwaysAsk; |
358 mComboboxIndex = ConnectionAlwaysAsk; |
355 } |
359 } |
356 else if (majorRole & BtuiDevProperty::Connected) { |
360 else if (majorRole & BtuiDevProperty::Connected) { |
357 mDeviceStatus->setPlainText(hbTrId("txt_bt_info_connected")); |
361 mDeviceStatus->setPlainText(hbTrId("txt_bt_info_connected")); |
358 mCombobox->setContentWidgetData("currentIndex", ConnectionAlwaysAsk ); |
362 mCombobox->setCurrentIndex(ConnectionAlwaysAsk ); |
359 mComboboxIndex = ConnectionAlwaysAsk; |
363 mComboboxIndex = ConnectionAlwaysAsk; |
360 } |
364 } |
361 else if (majorRole & BtuiDevProperty::Blocked) { |
365 else if (majorRole & BtuiDevProperty::Blocked) { |
362 mDeviceStatus->setPlainText(hbTrId("txt_bt_info_blocked")); |
366 mDeviceStatus->setPlainText(hbTrId("txt_bt_info_blocked")); |
363 mCombobox->setContentWidgetData("currentIndex", ConnectionBlocked ); |
367 mCombobox->setCurrentIndex(ConnectionBlocked ); |
364 mComboboxIndex = ConnectionBlocked; |
368 mComboboxIndex = ConnectionBlocked; |
365 } |
369 } |
366 else { |
370 else { |
367 // device not paired, connected, trusted or blocked. |
371 // device not paired, connected, trusted or blocked. |
368 mDeviceStatus->setPlainText(" "); |
372 mDeviceStatus->setPlainText(" "); |
369 mCombobox->setContentWidgetData("currentIndex", ConnectionAlwaysAsk ); |
373 mCombobox->setCurrentIndex(ConnectionAlwaysAsk ); |
370 mComboboxIndex = ConnectionAlwaysAsk; |
374 mComboboxIndex = ConnectionAlwaysAsk; |
371 } |
375 } |
372 mConnectionDataForm->addConnection(mCombobox, SIGNAL(currentIndexChanged (int)), |
376 ret = connect(mCombobox, SIGNAL(currentIndexChanged (int)), |
373 this, SLOT(connectionPreferenceChanged(int))); |
377 this, SLOT(connectionPreferenceChanged(int))); |
374 BOstraceFunctionExit0(DUMMY_DEVLIST); |
378 BTUI_ASSERT_X( ret, "Btui, BtcpuiDeviceView::setDeviceStatus", "currentIndexChanged() connect failed"); |
375 } |
379 |
376 |
380 BOstraceFunctionExit0(DUMMY_DEVLIST); |
377 void BtcpuiDeviceView::setConnectionCombobox() |
|
378 { |
|
379 BOstraceFunctionEntry1( DUMMY_DEVLIST, this ); |
|
380 //create a model class |
|
381 mCombobox = mConnectionComboboxModel->appendDataFormItem( |
|
382 HbDataFormModelItem::ComboBoxItem, hbTrId("txt_bt_setlabel_connection"), |
|
383 mConnectionComboboxModel->invisibleRootItem()); |
|
384 |
|
385 QStringList connList; |
|
386 connList.append( hbTrId("txt_bt_setlabel_bluetooth_val_automatic") ); |
|
387 connList.append( hbTrId("txt_bt_setlabel_bluetooth_val_always_ask") ); |
|
388 connList.append( hbTrId("txt_bt_setlabel_bluetooth_val_blocked") ); |
|
389 mCombobox->setContentWidgetData( "items", connList ); |
|
390 |
|
391 //set the model to the view, once model and data class are created |
|
392 mConnectionDataForm->setModel(mConnectionComboboxModel); |
|
393 mConnectionDataForm->addConnection(mCombobox, SIGNAL(currentIndexChanged (int)), |
|
394 this, SLOT(connectionPreferenceChanged(int))); |
|
395 BOstraceFunctionExit0(DUMMY_DEVLIST); |
|
396 } |
381 } |
397 |
382 |
398 void BtcpuiDeviceView::setTextAndVisibilityOfButtons(int majorProperty) |
383 void BtcpuiDeviceView::setTextAndVisibilityOfButtons(int majorProperty) |
399 { |
384 { |
400 BOstraceFunctionEntry1( DUMMY_DEVLIST, this ); |
385 BOstraceFunctionEntry1( DUMMY_DEVLIST, this ); |