17 |
17 |
18 #include <qcontactgeolocation.h> |
18 #include <qcontactgeolocation.h> |
19 #include <qcontactmanager.h> |
19 #include <qcontactmanager.h> |
20 #include <qtcontacts.h> |
20 #include <qtcontacts.h> |
21 #include <cntdef.h> |
21 #include <cntdef.h> |
22 #include <qstring> |
22 #include <agendautil.h> |
|
23 #include <agendaentry.h> |
|
24 #include <QString> |
|
25 #include <locationservicedefines.h> |
23 |
26 |
24 #include "geocodeupdate.h" |
27 #include "geocodeupdate.h" |
25 #include "mylocationsdefines.h" |
28 #include "mylocationsdefines.h" |
26 #include "mylocationlogger.h" |
29 #include "mylocationlogger.h" |
27 |
30 |
28 using namespace QTM_NAMESPACE; |
31 using namespace QTM_NAMESPACE; |
29 // ---------------------------------------------------------------------------- |
32 // ---------------------------------------------------------------------------- |
30 // CGeocodeUpdate::CreateContactdb() |
33 // GeocodeUpdate::createContactdb() |
31 // ---------------------------------------------------------------------------- |
34 // ---------------------------------------------------------------------------- |
32 EXPORT_C void GeocodeUpdate::CreateContactdb() |
35 EXPORT_C void GeocodeUpdate::createContactdb() |
33 { |
36 { |
34 QContactManager* contactManger = NULL; |
37 QContactManager* contactManger = NULL; |
35 MYLOCLOGSTRING("call to create contactManger object and contactdb as well."); |
38 MYLOCLOGSTRING("call to create contactManger object and contactdb as well."); |
36 contactManger = new QContactManager("symbian"); |
39 contactManger = new QContactManager("symbian"); |
37 delete contactManger; |
40 delete contactManger; |
38 } |
41 } |
39 |
42 |
40 // ---------------------------------------------------------------------------- |
43 // ---------------------------------------------------------------------------- |
41 // CGeocodeUpdate::UpDateL() |
44 // CGeocodeUpdate::updateGeocodeToContactDB() |
42 // To update contact db with this latitude and longitude value |
45 // Geo-cordinate updation to contact db |
43 // ---------------------------------------------------------------------------- |
46 // ---------------------------------------------------------------------------- |
44 EXPORT_C void GeocodeUpdate::UpDate(const TInt32 aCntId, |
47 EXPORT_C void GeocodeUpdate::updateGeocodeToContactDB(const quint32 contactId, |
45 const TInt32 aCntAddressType, const TReal aLatitude, |
48 const int addressType, const double latitude, |
46 const TReal aLongitude) |
49 const double longitude) |
47 |
50 |
48 { |
51 { |
49 __TRACE_CALLSTACK; |
52 __TRACE_CALLSTACK; |
50 QContactManager* contactManger = NULL; |
53 QContactManager* contactManger = NULL; |
51 MYLOCLOGSTRING("call to create contactManger object ."); |
54 MYLOCLOGSTRING("call to create contactManger object ."); |
52 contactManger = new QContactManager("symbian"); |
55 contactManger = new QContactManager("symbian"); |
53 MYLOCLOGSTRING("contactManger object created ."); |
56 MYLOCLOGSTRING("contactManger object created ."); |
54 |
57 |
55 MYLOCLOGSTRING("contactManger object is not null ."); |
58 MYLOCLOGSTRING("contactManger object is not null ."); |
56 QStringList definitionRestrictions; |
59 QStringList definitionRestrictions; |
57 QContact contact = contactManger->contact(aCntId ,definitionRestrictions); |
60 QContact contact = contactManger->contact(contactId ,definitionRestrictions); |
58 QContactGeoLocation location; |
61 QContactGeoLocation location; |
59 |
62 |
60 switch (aCntAddressType) |
63 switch (addressType) |
61 { |
64 { |
62 case ESourceContactsPref: |
65 case ESourceContactsPref: |
63 { |
66 { |
64 break; |
67 break; |
65 } |
68 } |
76 default: |
79 default: |
77 { |
80 { |
78 break; |
81 break; |
79 } |
82 } |
80 } |
83 } |
81 location.setLongitude(aLongitude); |
84 location.setLongitude(longitude); |
82 location.setLatitude(aLatitude); |
85 location.setLatitude(latitude); |
83 contact.saveDetail(&location); |
86 contact.saveDetail(&location); |
84 contactManger->saveContact(&contact); |
87 contactManger->saveContact(&contact); |
85 delete contactManger; |
88 delete contactManger; |
86 |
89 |
87 } |
90 } |
88 |
91 |
|
92 // ---------------------------------------------------------------------------- |
|
93 // CGeocodeUpdate::updateGeocodeToCalenderDB() |
|
94 // Geo-cordinate updation to contact db |
|
95 // ---------------------------------------------------------------------------- |
|
96 EXPORT_C void GeocodeUpdate::updateGeocodeToCalenderDB(const ulong calEntryId, |
|
97 const double latitude, const double longitude) |
|
98 |
|
99 { |
|
100 __TRACE_CALLSTACK; |
|
101 AgendaUtil agendaUtil; |
|
102 AgendaEntry agendaEntry (agendaUtil.fetchById(calEntryId)); |
|
103 MYLOCLOGSTRING("agenda entry created from calender id ."); |
|
104 AgendaGeoValue geoValue; |
|
105 geoValue.setLatLong(latitude,longitude); |
|
106 MYLOCLOGSTRING("latitude and longitude set to AgendaGeoValue object."); |
|
107 agendaEntry.setGeoValue(geoValue); |
|
108 agendaUtil.updateEntry(agendaEntry); |
|
109 } |
89 //end of line |
110 //end of line |