equal
deleted
inserted
replaced
34 quint32 CCreatorPhonebookAPI::saveContact( const QList<QContactDetail>& list ) |
34 quint32 CCreatorPhonebookAPI::saveContact( const QList<QContactDetail>& list ) |
35 { |
35 { |
36 // create a new contact item |
36 // create a new contact item |
37 QContact store; |
37 QContact store; |
38 quint32 id; |
38 quint32 id; |
39 bool success = false; |
|
40 for(int i = 0 ; i < list.count() ; i++ ) |
39 for(int i = 0 ; i < list.count() ; i++ ) |
41 { |
40 { |
42 QContactDetail cntdetail = list.at(i); |
41 QContactDetail cntdetail = list.at(i); |
43 success = store.saveDetail(&cntdetail); |
42 store.saveDetail(&cntdetail); |
44 } |
43 } |
45 /*foreach( QContactDetail cntdetail, list ) |
44 /*foreach( QContactDetail cntdetail, list ) |
46 { |
45 { |
47 success = store.saveDetail( &cntdetail ); |
46 store.saveDetail( &cntdetail ); |
48 } |
47 } |
49 */ |
48 */ |
50 success = mContactMngr->saveContact( &store ); |
49 mContactMngr->saveContact( &store ); |
51 id = store.localId(); |
50 id = store.localId(); |
52 return id; |
51 return id; |
53 } |
52 } |
54 |
53 |
55 quint32 CCreatorPhonebookAPI::createGroup( const QString& groupName ) |
54 quint32 CCreatorPhonebookAPI::createGroup( const QString& groupName ) |
156 |
155 |
157 QContact CCreatorPhonebookAPI::contact( const QContactLocalId& contactId ) |
156 QContact CCreatorPhonebookAPI::contact( const QContactLocalId& contactId ) |
158 { |
157 { |
159 return mContactMngr->contact( contactId ); |
158 return mContactMngr->contact( contactId ); |
160 } |
159 } |
|
160 |
|
161 QString CCreatorPhonebookAPI::phoneNumber( const QContactLocalId& contactId ) |
|
162 { |
|
163 QString strNumber; |
|
164 QContact contact = mContactMngr->contact( contactId ); |
|
165 if( !contact.isEmpty() ) |
|
166 { |
|
167 QContactPhoneNumber phoneNumber = static_cast<QContactPhoneNumber>( contact.detail( QContactPhoneNumber::DefinitionName ) ); |
|
168 strNumber = phoneNumber.number(); |
|
169 } |
|
170 return strNumber; |
|
171 } |
|
172 |
|
173 bool CCreatorPhonebookAPI::contactDetails( const QContactLocalId& contactId, QString& name, QString& phoneNumber, QString& email ) |
|
174 { |
|
175 bool success(false); |
|
176 QContact contact = mContactMngr->contact( contactId ); |
|
177 if( !contact.isEmpty() ) |
|
178 { |
|
179 QContactPhoneNumber contactPhoneNumber = static_cast<QContactPhoneNumber>( contact.detail( QContactPhoneNumber::DefinitionName ) ); |
|
180 phoneNumber = contactPhoneNumber.number(); |
|
181 QContactEmailAddress contactEmailAddress = static_cast<QContactEmailAddress>( contact.detail( QContactEmailAddress::DefinitionName ) ); |
|
182 email = contactEmailAddress.emailAddress(); |
|
183 QContactDisplayLabel contactDisplayLabel = static_cast<QContactDisplayLabel>( contact.detail( QContactDisplayLabel::DefinitionName ) ); |
|
184 name = contactDisplayLabel.label(); |
|
185 success = true; |
|
186 } |
|
187 return success; |
|
188 } |
161 // End of File |
189 // End of File |