bluetoothengine/btui/btcpplugin/btcpuidevicedetailsview.cpp
changeset 57 5ebadcda06cb
parent 47 9e2a905b887f
child 67 16e4b9007960
equal deleted inserted replaced
51:625f43ae9362 57:5ebadcda06cb
    31 BtCpUiDeviceDetailsView::BtCpUiDeviceDetailsView(QGraphicsItem *parent)
    31 BtCpUiDeviceDetailsView::BtCpUiDeviceDetailsView(QGraphicsItem *parent)
    32     :CpBaseSettingView( 0 , parent )
    32     :CpBaseSettingView( 0 , parent )
    33 {
    33 {
    34    
    34    
    35     mSoftKeyBackAction = new HbAction(Hb::BackNaviAction, this);
    35     mSoftKeyBackAction = new HbAction(Hb::BackNaviAction, this);
    36     BTUI_ASSERT_X(mSoftKeyBackAction, "BtCpUiBaseView::BtCpUiBaseView", "can't create back action");
    36     BTUI_ASSERT_X(mSoftKeyBackAction, "BtCpUiDeviceDetailsView::BtCpUiDeviceDetailsView", "can't create back action");
    37 
    37 
    38     // Create view for the application.
    38     // Create view for the application.
    39     // Set the name for the view. The name should be same as the view's
    39     // Set the name for the view. The name should be same as the view's
    40     // name in docml.
    40     // name in docml.
    41     setObjectName("bt_device_details_view");
    41     setObjectName("bt_device_details_view");
    66 
    66 
    67 }
    67 }
    68 
    68 
    69 void BtCpUiDeviceDetailsView::setDeviceName(const QString &deviceName)
    69 void BtCpUiDeviceDetailsView::setDeviceName(const QString &deviceName)
    70 {
    70 {
    71     //todo: use Localised string Id.
    71     BOstraceFunctionEntry1( DUMMY_DEVLIST, this );
       
    72     //todo: use Localised string Id,If Loc ID is used
       
    73     //wrong string is displayed. Need to correct text map file.
    72     QString heading(hbTrId("%1 details"));
    74     QString heading(hbTrId("%1 details"));
    73     
    75     
    74     if(mGroupBox) {
    76     if(mGroupBox) {
    75         mGroupBox->setHeading(heading.arg(deviceName));
    77         mGroupBox->setHeading(heading.arg(deviceName));
    76     }
    78     }
       
    79     BOstraceFunctionExit0(DUMMY_DEVLIST);
    77 }
    80 }
    78 
    81 
    79 void BtCpUiDeviceDetailsView::addItem(HbDataForm *item)
    82 void BtCpUiDeviceDetailsView::addItem(HbDataForm *item)
    80 {
    83 {
       
    84     BOstraceFunctionEntry1( DUMMY_DEVLIST, this );
    81     if (item && mLayout) {
    85     if (item && mLayout) {
    82         mLayout->addItem(item);
    86         mLayout->addItem(item);
    83     }    
    87     }
       
    88     BOstraceFunctionExit0(DUMMY_DEVLIST);
    84 }
    89 }
    85 
    90 
    86 void BtCpUiDeviceDetailsView::removeItem(HbDataForm *item)
    91 void BtCpUiDeviceDetailsView::removeItem(HbDataForm *item)
    87 {
    92 {
       
    93     BOstraceFunctionEntry1( DUMMY_DEVLIST, this );
    88     if (item && mLayout) {
    94     if (item && mLayout) {
    89         //todo: with out this item is not removed from the view.
    95         //todo: with out this item is not removed from the view.
    90         item->setVisible(false);
    96         item->setVisible(false);
    91         mLayout->removeItem(item);
    97         mLayout->removeItem(item);
       
    98         delete item;
    92     }
    99     }
       
   100     BOstraceFunctionExit0(DUMMY_DEVLIST);
    93 }
   101 }
    94 
   102 
       
   103 void BtCpUiDeviceDetailsView::removeAllItems()
       
   104 {
       
   105     BOstraceFunctionEntry1( DUMMY_DEVLIST, this );
       
   106     if(mLayout) {
       
   107         QGraphicsLayoutItem *item;
       
   108         int count = mLayout->count();
       
   109         for(int i=count-1; i>=0; i--) {
       
   110             item = mLayout->itemAt(i);
       
   111             mLayout->removeItem(item);
       
   112             delete item;
       
   113         }
       
   114     }
       
   115     BOstraceFunctionExit0(DUMMY_DEVLIST);
       
   116 }