bluetoothengine/btui/btcpplugin/btcpuimainview.cpp
changeset 70 f5508c13dfe0
parent 67 16e4b9007960
--- a/bluetoothengine/btui/btcpplugin/btcpuimainview.cpp	Wed Oct 13 13:15:31 2010 +0300
+++ b/bluetoothengine/btui/btcpplugin/btcpuimainview.cpp	Tue Oct 19 15:09:34 2010 +0300
@@ -533,12 +533,14 @@
             if (val) {
                 HbIcon icon("qtg_mono_bluetooth");
                 icon.setIconName("qtg_mono_bluetooth");
-                mPowerButton->setIcon(icon);  
+                mPowerButton->setIcon(icon); 
+                mPowerButton->setChecked(true);
             }
             else {
                 HbIcon icon("qtg_mono_bluetooth_off");
                 icon.setIconName("qtg_mono_bluetooth_off");
                 mPowerButton->setIcon(icon);
+                mPowerButton->setChecked(false);
             }
             break;
         case BtSettingModel::VisibilityRow:
@@ -569,11 +571,24 @@
         powerState = BtPowerOff;
     } 
     (void) createExecuteDelegate(BtDelegate::ManagePower, 
-            this, SLOT(handleDelegateCompleted(int,BtAbstractDelegate*)), 
+            this, SLOT(powerDelegateCompleted(int)), 
             QVariant((int)powerState));
     BOstraceFunctionExit0(DUMMY_DEVLIST); 
 }
 
+void BtcpuiMainView::powerDelegateCompleted(int status)
+{   
+    BOstraceFunctionEntry1( DUMMY_DEVLIST, this );
+    if(KErrNone != status) {
+	    QModelIndex top = mSettingModel->index( BtSettingModel::PowerStateRow, 0 );
+	    QModelIndex bottom = mSettingModel->index( BtSettingModel::PowerStateRow, 0 );
+	    // update power rows only
+	    updateSettingItems( top, bottom );
+	}
+    handleDelegateCompleted(status, mDelegate);
+    BOstraceFunctionExit0(DUMMY_DEVLIST);
+}
+
 void BtcpuiMainView::loadDocument()
 {
     bool ret(false);
@@ -637,6 +652,7 @@
     BTUI_ASSERT_X( mPowerButton != 0, "bt-main-view", "power button not found" );
     ret =  connect(mPowerButton, SIGNAL(clicked()), this, SLOT(changePowerState()));
     BTUI_ASSERT_X( ret, "BtcpuiMainView::BtcpuiMainView", "can't connect power button" );
+    mPowerButton->setCheckable(true);
     
     mVisibilityMode=0;
     mVisibilityMode = qobject_cast<HbComboBox *>( mLoader->findWidget( "visibilityMode" ) );