phonebookui/pbkcommonui/src/cntaddressviewitem.cpp
changeset 59 a642906a277a
parent 47 7cbcb2896f0e
child 61 d30183af6ca6
equal deleted inserted replaced
47:7cbcb2896f0e 59:a642906a277a
    68 HbWidget* CntAddressViewItem::createCustomWidget()
    68 HbWidget* CntAddressViewItem::createCustomWidget()
    69 {
    69 {
    70     HbDataFormModelItem::DataItemType itemType = static_cast<HbDataFormModelItem::DataItemType>( 
    70     HbDataFormModelItem::DataItemType itemType = static_cast<HbDataFormModelItem::DataItemType>( 
    71               modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt());
    71               modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt());
    72     
    72     
    73     HbWidget* widget = new HbWidget();
    73     HbWidget* widget = NULL;
       
    74     
    74     if( itemType ==  HbDataFormModelItem::CustomItemBase )
    75     if( itemType ==  HbDataFormModelItem::CustomItemBase )
    75     {
    76     {
    76         QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Horizontal);
    77         HbPushButton* locationButton = new HbPushButton(this);
    77         widget->setLayout(layout);
    78         
       
    79         // Naming UI components for automation testability
       
    80         locationButton->setObjectName("Select location button");
       
    81         locationButton->setText( hbTrId("txt_phob_button_select_location") );
       
    82         locationButton->setTextAlignment( Qt::AlignCenter );
       
    83         locationButton->setContentsMargins(0,0,0,0);
    78     
    84     
    79         HbStyleLoader::registerFilePath(":/style/cntlocationbutton.css");
    85         connect(locationButton, SIGNAL(clicked()), this, SLOT(launchLocationPicker()));
    80         HbStyleLoader::registerFilePath(":/style/cntlocationbutton.hbpushbutton.widgetml");
       
    81         HbDataForm* form = static_cast<HbDataForm*> (itemView());
       
    82         HbDataFormModel* model = static_cast<HbDataFormModel*> (form->model());
       
    83     
    86     
    84         HbPushButton* mLocationButton = new HbPushButton(this);
    87         widget = locationButton;
    85         mLocationButton->setObjectName("cntlocationbutton");
       
    86         mLocationButton->setText( hbTrId("txt_phob_button_select_location") );
       
    87         mLocationButton->setTextAlignment( Qt::AlignCenter );
       
    88     
       
    89         connect(mLocationButton, SIGNAL(clicked()), this, SLOT(launchLocationPicker()));
       
    90     
       
    91         layout->addItem(mLocationButton);
       
    92         
    88         
    93     }
    89     }
    94     return widget;
    90     return widget;
    95 }
    91 }
    96 
    92 
   149 
   145 
   150     }
   146     }
   151    
   147    
   152 }
   148 }
   153 
   149 
   154  Q_IMPLEMENT_USER_METATYPE(QLocationPickerItem)
   150 Q_IMPLEMENT_USER_METATYPE(QLocationPickerItem)
   155 
   151 
   156 // End of File
   152 // End of File