locationdataharvester/geocodeupdate/src/geocodeupdate.cpp
changeset 41 b3dd5ec3089d
parent 35 59575560d1e6
equal deleted inserted replaced
38:793f76d9ab0c 41:b3dd5ec3089d
    45 // ----------------------------------------------------------------------------
    45 // ----------------------------------------------------------------------------
    46 // GeocodeUpdate::~GeocodeUpdate()
    46 // GeocodeUpdate::~GeocodeUpdate()
    47 // ----------------------------------------------------------------------------
    47 // ----------------------------------------------------------------------------
    48 GeocodeUpdate::~GeocodeUpdate()
    48 GeocodeUpdate::~GeocodeUpdate()
    49 {
    49 {
    50     __TRACE_CALLSTACK;
    50     __TRACE_CALLSTACK;    
    51     if (mUtilInstanceCreated) {
    51     delete mAgendaUtil;    
    52         delete mAgendaUtil;
       
    53     }
       
    54 }
    52 }
    55 
    53 
    56 // ----------------------------------------------------------------------------
    54 // ----------------------------------------------------------------------------
    57 // GeocodeUpdate::createContactdb()
    55 // GeocodeUpdate::createContactdb()
    58 // ----------------------------------------------------------------------------
    56 // ----------------------------------------------------------------------------
    76     QContactManager* contactManger = NULL;
    74     QContactManager* contactManger = NULL;
    77     MYLOCLOGSTRING("call to create contactManger object .");
    75     MYLOCLOGSTRING("call to create contactManger object .");
    78     contactManger = new QContactManager("symbian");
    76     contactManger = new QContactManager("symbian");
    79     MYLOCLOGSTRING("contactManger object created .");
    77     MYLOCLOGSTRING("contactManger object created .");
    80 
    78 
       
    79 
    81     MYLOCLOGSTRING("contactManger object is not null .");
    80     MYLOCLOGSTRING("contactManger object is not null .");
    82     QContact contact = contactManger->contact(contactId);
    81     QContact contact = contactManger->contact(contactId);
    83     QContactGeoLocation location;
    82     QContactGeoLocation *location=NULL;
       
    83     location=new QContactGeoLocation();
    84 
    84 
    85     switch (addressType) {
    85     switch (addressType) {
    86         case ESourceContactsPref:
    86         case ESourceContactsPref:
    87         {
    87         {
    88             break;
    88             break;
    89         }
    89         }
    90         case ESourceContactsWork:
    90         case ESourceContactsWork:
    91         {
    91         {
    92             location.setContexts(QContactDetail::ContextWork);
    92             location->setContexts(QContactDetail::ContextWork);
    93             break;
    93             break;
    94         }
    94         }
    95         case ESourceContactsHome:
    95         case ESourceContactsHome:
    96         {
    96         {
    97             location.setContexts(QContactDetail::ContextHome);
    97             location->setContexts(QContactDetail::ContextHome);
    98             break;
    98             break;
    99         }
    99         }
   100         default:
   100         default:
   101         {
   101         {
       
   102             delete location;                
       
   103             delete contactManger;
   102             return false;
   104             return false;
   103         }
   105         }
   104     }
   106     }
   105     location.setLongitude(longitude);
   107     location->setLongitude(longitude);
   106     location.setLatitude(latitude);
   108     location->setLatitude(latitude);
   107     contact.saveDetail(&location);
   109     contact.saveDetail(location);
       
   110     delete location;
       
   111     location=NULL;
   108     bool ret = false;
   112     bool ret = false;
   109     ret = contactManger->saveContact(&contact);
   113     ret = contactManger->saveContact(&contact);
   110     delete contactManger;
   114     delete contactManger;
   111     return ret;
   115     return ret;
   112 }
   116 }