phonebookui/pbkcommonui/src/cntaddressmodel.cpp
changeset 65 ae724a111993
parent 47 7cbcb2896f0e
child 66 554fe4dbbb59
equal deleted inserted replaced
59:a642906a277a 65:ae724a111993
    16 */
    16 */
    17 
    17 
    18 #include "cntaddressmodel.h"
    18 #include "cntaddressmodel.h"
    19 #include "cntdetailmodelitem.h"
    19 #include "cntdetailmodelitem.h"
    20 #include "cntdetailconst.h"
    20 #include "cntdetailconst.h"
    21 #include <cntmaptileservice.h> 
    21 #include <maptileservice.h> 
    22 
    22 
    23 CntAddressModel::CntAddressModel( QContact* aContact ):
    23 CntAddressModel::CntAddressModel( QContact* aContact ):
    24 CntDetailEditorModel( aContact ),
    24 CntDetailEditorModel( aContact ),
    25 mAddress(NULL),
    25 mAddress(NULL),
    26 mAddressHome(NULL),
    26 mAddressHome(NULL),
    27 mAddressWork(NULL),
    27 mAddressWork(NULL),
    28 mIsLocationPickerEnabled( false )
    28 mIsLocationPickerEnabled( false )
    29     {
    29     {
    30     mMaptileInterface = new CntMapTileService;
    30     mMaptileInterface = new MapTileService;
    31     HbDataFormModelItem* address = appendDataFormGroup(hbTrId("txt_phob_formlabel_address"), invisibleRootItem());
    31     HbDataFormModelItem* address = appendDataFormGroup(hbTrId("txt_phob_formlabel_address"), invisibleRootItem());
    32     HbDataFormModelItem* addressHome = appendDataFormGroup(hbTrId("txt_phob_formlabel_address_home"), invisibleRootItem());
    32     HbDataFormModelItem* addressHome = appendDataFormGroup(hbTrId("txt_phob_formlabel_address_home"), invisibleRootItem());
    33     HbDataFormModelItem* addressWork = appendDataFormGroup(hbTrId("txt_phob_formlabel_address_work"), invisibleRootItem());
    33     HbDataFormModelItem* addressWork = appendDataFormGroup(hbTrId("txt_phob_formlabel_address_work"), invisibleRootItem());
    34     
    34     
    35     foreach ( QContactAddress a, mContact->details<QContactAddress>() )
    35     foreach ( QContactAddress a, mContact->details<QContactAddress>() )
    89     }
    89     }
    90 
    90 
    91 void CntAddressModel::createAddressItems( HbDataFormModelItem* aGroup, QContactAddress* aAddress )
    91 void CntAddressModel::createAddressItems( HbDataFormModelItem* aGroup, QContactAddress* aAddress )
    92     {
    92     {
    93 	//Show the location picker button only if location feature enabled
    93 	//Show the location picker button only if location feature enabled
    94     if( mMaptileInterface->isLocationFeatureEnabled() )
    94     if( mMaptileInterface->isLocationFeatureEnabled(MapTileService::AppTypeContacts) )
    95     {
    95     {
    96         // custom item for map button
    96         // custom item for map button
    97         HbDataFormModelItem* mapButton = new HbDataFormModelItem( HbDataFormModelItem::CustomItemBase );
    97         HbDataFormModelItem* mapButton = new HbDataFormModelItem( HbDataFormModelItem::CustomItemBase );
    98         appendDataFormItem( mapButton, aGroup );
    98         appendDataFormItem( mapButton, aGroup );
    99         mIsLocationPickerEnabled = true;
    99         mIsLocationPickerEnabled = true;
   188 }
   188 }
   189 
   189 
   190 bool CntAddressModel::saveAddressItems( HbDataFormModelItem* aGroup, QContactAddress* aAddress )
   190 bool CntAddressModel::saveAddressItems( HbDataFormModelItem* aGroup, QContactAddress* aAddress )
   191 {
   191 {
   192     int offset = 0;
   192     int offset = 0;
   193     if( mMaptileInterface->isLocationFeatureEnabled() )
   193     if( mMaptileInterface->isLocationFeatureEnabled(MapTileService::AppTypeContacts) )
   194     {
   194     {
   195         offset = 1;
   195         offset = 1;
   196     }
   196     }
   197     
   197     
   198 	QString street = aGroup->childAt( 0 + offset  )->contentWidgetData("text").toString().trimmed();
   198 	QString street = aGroup->childAt( 0 + offset  )->contentWidgetData("text").toString().trimmed();