bluetoothengine/btui/btcpplugin/btcpuimainview.cpp
changeset 70 f5508c13dfe0
parent 67 16e4b9007960
equal deleted inserted replaced
67:16e4b9007960 70:f5508c13dfe0
   531         case BtSettingModel::PowerStateRow:
   531         case BtSettingModel::PowerStateRow:
   532             val = mSettingModel->data(index, BtSettingModel::SettingValueRole).toBool();
   532             val = mSettingModel->data(index, BtSettingModel::SettingValueRole).toBool();
   533             if (val) {
   533             if (val) {
   534                 HbIcon icon("qtg_mono_bluetooth");
   534                 HbIcon icon("qtg_mono_bluetooth");
   535                 icon.setIconName("qtg_mono_bluetooth");
   535                 icon.setIconName("qtg_mono_bluetooth");
   536                 mPowerButton->setIcon(icon);  
   536                 mPowerButton->setIcon(icon); 
       
   537                 mPowerButton->setChecked(true);
   537             }
   538             }
   538             else {
   539             else {
   539                 HbIcon icon("qtg_mono_bluetooth_off");
   540                 HbIcon icon("qtg_mono_bluetooth_off");
   540                 icon.setIconName("qtg_mono_bluetooth_off");
   541                 icon.setIconName("qtg_mono_bluetooth_off");
   541                 mPowerButton->setIcon(icon);
   542                 mPowerButton->setIcon(icon);
       
   543                 mPowerButton->setChecked(false);
   542             }
   544             }
   543             break;
   545             break;
   544         case BtSettingModel::VisibilityRow:
   546         case BtSettingModel::VisibilityRow:
   545             mVisibilityMode->setCurrentIndex ( visibilityModeToIndex((VisibilityMode)
   547             mVisibilityMode->setCurrentIndex ( visibilityModeToIndex((VisibilityMode)
   546                     mSettingModel->data(index,BtSettingModel::SettingValueRole).toInt()) );
   548                     mSettingModel->data(index,BtSettingModel::SettingValueRole).toInt()) );
   567     }
   569     }
   568     else {
   570     else {
   569         powerState = BtPowerOff;
   571         powerState = BtPowerOff;
   570     } 
   572     } 
   571     (void) createExecuteDelegate(BtDelegate::ManagePower, 
   573     (void) createExecuteDelegate(BtDelegate::ManagePower, 
   572             this, SLOT(handleDelegateCompleted(int,BtAbstractDelegate*)), 
   574             this, SLOT(powerDelegateCompleted(int)), 
   573             QVariant((int)powerState));
   575             QVariant((int)powerState));
   574     BOstraceFunctionExit0(DUMMY_DEVLIST); 
   576     BOstraceFunctionExit0(DUMMY_DEVLIST); 
       
   577 }
       
   578 
       
   579 void BtcpuiMainView::powerDelegateCompleted(int status)
       
   580 {   
       
   581     BOstraceFunctionEntry1( DUMMY_DEVLIST, this );
       
   582     if(KErrNone != status) {
       
   583 	    QModelIndex top = mSettingModel->index( BtSettingModel::PowerStateRow, 0 );
       
   584 	    QModelIndex bottom = mSettingModel->index( BtSettingModel::PowerStateRow, 0 );
       
   585 	    // update power rows only
       
   586 	    updateSettingItems( top, bottom );
       
   587 	}
       
   588     handleDelegateCompleted(status, mDelegate);
       
   589     BOstraceFunctionExit0(DUMMY_DEVLIST);
   575 }
   590 }
   576 
   591 
   577 void BtcpuiMainView::loadDocument()
   592 void BtcpuiMainView::loadDocument()
   578 {
   593 {
   579     bool ret(false);
   594     bool ret(false);
   635     mPowerButton=0;
   650     mPowerButton=0;
   636     mPowerButton = qobject_cast<HbPushButton *>( mLoader->findWidget( "toggleBluetoothPower" ) );
   651     mPowerButton = qobject_cast<HbPushButton *>( mLoader->findWidget( "toggleBluetoothPower" ) );
   637     BTUI_ASSERT_X( mPowerButton != 0, "bt-main-view", "power button not found" );
   652     BTUI_ASSERT_X( mPowerButton != 0, "bt-main-view", "power button not found" );
   638     ret =  connect(mPowerButton, SIGNAL(clicked()), this, SLOT(changePowerState()));
   653     ret =  connect(mPowerButton, SIGNAL(clicked()), this, SLOT(changePowerState()));
   639     BTUI_ASSERT_X( ret, "BtcpuiMainView::BtcpuiMainView", "can't connect power button" );
   654     BTUI_ASSERT_X( ret, "BtcpuiMainView::BtcpuiMainView", "can't connect power button" );
       
   655     mPowerButton->setCheckable(true);
   640     
   656     
   641     mVisibilityMode=0;
   657     mVisibilityMode=0;
   642     mVisibilityMode = qobject_cast<HbComboBox *>( mLoader->findWidget( "visibilityMode" ) );
   658     mVisibilityMode = qobject_cast<HbComboBox *>( mLoader->findWidget( "visibilityMode" ) );
   643     BTUI_ASSERT_X( mVisibilityMode != 0, "bt-main-view", "visibility combobox not found" );
   659     BTUI_ASSERT_X( mVisibilityMode != 0, "bt-main-view", "visibility combobox not found" );
   644     // add new item for temporary visibility
   660     // add new item for temporary visibility