本文整理汇总了C++中kabc::Addressee::insertAddress方法的典型用法代码示例。如果您正苦于以下问题:C++ Addressee::insertAddress方法的具体用法?C++ Addressee::insertAddress怎么用?C++ Addressee::insertAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kabc::Addressee
的用法示例。
在下文中一共展示了Addressee::insertAddress方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: storeContact
void AddressEditWidget::storeContact( KABC::Addressee &contact ) const
{
// delete all previous addresses
const KABC::Address::List oldAddresses = contact.addresses();
for ( int i = 0; i < oldAddresses.count(); ++i ) {
contact.removeAddress( oldAddresses.at( i ) );
}
// insert the new ones
for ( int i = 0; i < mAddressList.count(); ++i ) {
const KABC::Address address( mAddressList.at( i ) );
if ( !address.isEmpty() ) {
contact.insertAddress( address );
}
}
}
示例2: itemFromEntry
Akonadi::Item ContactsHandler::itemFromEntry(const KDSoapGenerated::TNS__Entry_value &entry, const Akonadi::Collection &parentCollection)
{
Akonadi::Item item;
const QList<KDSoapGenerated::TNS__Name_value> valueList = entry.name_value_list().items();
if (valueList.isEmpty()) {
kWarning() << "Contacts entry for id=" << entry.id() << "has no values";
return item;
}
item.setRemoteId(entry.id());
item.setParentCollection(parentCollection);
item.setMimeType(KABC::Addressee::mimeType());
KABC::Addressee addressee;
addressee.setUid(entry.id());
KABC::Address workAddress, homeAddress;
workAddress.setType(KABC::Address::Work | KABC::Address::Pref);
homeAddress.setType(KABC::Address::Home);
Q_FOREACH (const KDSoapGenerated::TNS__Name_value &namedValue, valueList) {
const ContactAccessorHash::const_iterator accessIt = mAccessors->constFind(namedValue.name());
if (accessIt == mAccessors->constEnd()) {
// no accessor for field
continue;
}
const QString value = KDCRMUtils::decodeXML(namedValue.value());
if (isAddressValue(namedValue.name())) {
KABC::Address &address =
isPrimaryAddressValue(namedValue.name()) ? workAddress : homeAddress;
(*accessIt)->setter.aSetter(value, address);
} else {
(*accessIt)->setter.vSetter(value, addressee);
}
}
addressee.insertAddress(workAddress);
addressee.insertAddress(homeAddress);
item.setPayload<KABC::Addressee>(addressee);
item.setRemoteRevision(getDateModified(addressee));
return item;
}
示例3: importContacts
//.........这里部分代码省略.........
line = gmxStream.readLine();
while (!line.startsWith("####") && !gmxStream.atEnd()) {
while (1) {
strList = QStringList::split('#', line, true);
if (strList.count() >= 11)
break;
line.append('\n');
line.append(gmxStream.readLine());
};
KABC::Addressee *addr = new KABC::Addressee;
addr->setNickName(strList[1]);
addr->setGivenName(strList[2]);
addr->setFamilyName(strList[3]);
addr->setTitle(strList[4]);
if (addr->formattedName().isEmpty())
addr->setFormattedName(addr->realName());
if (checkDateTime(strList[5],dt)) addr->setBirthday(dt);
addr->setNote(strList[6]);
if (checkDateTime(strList[7],dt)) addr->setRevision(dt);
// addr->setStatus(strList[8]); Status
// addr->xxx(strList[9]); Address_link_id
// addr->setCategory(strList[10]); Categories
addrMap[strList[0]] = addr;
line = gmxStream.readLine();
}
// now read the address records
line = gmxStream.readLine();
if (!line.startsWith("AB_ADDRESS_RECORDS:")) {
kdWarning() << "Could not find address records!\n";
return addrList;
}
// Address_id,Record_id,Street,Country,Zipcode,City,Phone,Fax,Mobile,Mobile_type,Email,
// Homepage,Position,Comments,Record_type_id,Record_type,Company,Department,Change_date,Preferred,Status
line = gmxStream.readLine();
line = gmxStream.readLine();
while (!line.startsWith("####") && !gmxStream.atEnd()) {
while (1) {
strList = QStringList::split('#', line, true);
if (strList.count() >= 21)
break;
line.append('\n');
line.append(gmxStream.readLine());
};
KABC::Addressee *addr = addrMap[strList[0]];
if (addr) {
for ( QStringList::Iterator it = strList.begin(); it != strList.end(); ++it )
*it = (*it).simplifyWhiteSpace();
// strList[1] = Record_id (numbered item, ignore here)
int id = strList[14].toInt(); // Record_type_id (0=work,1=home,2=other)
int type = (id==0) ? KABC::Address::Work : KABC::Address::Home;
if (!strList[19].isEmpty() && strList[19].toInt()!=0)
type |= KABC::Address::Pref; // Preferred address (seems to be bitfield for telephone Prefs)
KABC::Address adr = addr->address(type);
adr.setStreet(strList[2]);
adr.setCountry(strList[3]);
adr.setPostalCode(strList[4]);
adr.setLocality(strList[5]);
addr->insertPhoneNumber( KABC::PhoneNumber(strList[6], KABC::PhoneNumber::Home) );
addr->insertPhoneNumber( KABC::PhoneNumber(strList[7], KABC::PhoneNumber::Fax) );
int celltype = KABC::PhoneNumber::Cell;
// strList[9]=Mobile_type // always 0 or -1(default phone).
if (strList[9].toInt()) celltype |= KABC::PhoneNumber::Pref;
addr->insertPhoneNumber( KABC::PhoneNumber(strList[8], celltype) );
addr->insertEmail(strList[10]);
if (!strList[11].isEmpty()) addr->setUrl(strList[11]);
if (!strList[12].isEmpty()) addr->setRole(strList[12]);
// strList[13]=Comments
// strList[14]=Record_type_id (0,1,2) - see above
// strList[15]=Record_type (name of this additional record entry)
if (!strList[16].isEmpty()) addr->setOrganization(strList[16]); // Company
if (!strList[17].isEmpty()) addr->insertCustom(
"KADDRESSBOOK", "X-Department", strList[17]); // Department
if (checkDateTime(strList[18],dt)) addr->setRevision(dt); // Change_date
// strList[19]=Preferred (see above)
// strList[20]=Status (should always be "1")
addr->insertAddress(adr);
} else {
kdWarning() << "unresolved line: " << line << endl;
}
line = gmxStream.readLine();
}
// now add the addresses to to addrList
for ( AddressMap::Iterator it = addrMap.begin(); it != addrMap.end(); ++it ) {
KABC::Addressee *addr = it.data();
addrList.append(*addr);
delete addr;
}
file.close();
return addrList;
}
示例4: tmpZone
//.........这里部分代码省略.........
if((*i).qualifiers.contains(VCARD_TEL_PREF))
type |= PhoneNumber::Pref;
// if ( (*i).qualifiers.contains( VCARD_TEL_VOICE ) )
// type |= PhoneNumber::Voice;
if((*i).qualifiers.contains(VCARD_TEL_FAX))
type |= PhoneNumber::Fax;
if((*i).qualifiers.contains(VCARD_TEL_MSG))
type |= PhoneNumber::Msg;
if((*i).qualifiers.contains(VCARD_TEL_CELL))
type |= PhoneNumber::Cell;
if((*i).qualifiers.contains(VCARD_TEL_PAGER))
type |= PhoneNumber::Pager;
if((*i).qualifiers.contains(VCARD_TEL_BBS))
type |= PhoneNumber::Bbs;
if((*i).qualifiers.contains(VCARD_TEL_MODEM))
type |= PhoneNumber::Modem;
if((*i).qualifiers.contains(VCARD_TEL_CAR))
type |= PhoneNumber::Car;
if((*i).qualifiers.contains(VCARD_TEL_ISDN))
type |= PhoneNumber::Isdn;
if((*i).qualifiers.contains(VCARD_TEL_VIDEO))
type |= PhoneNumber::Video;
if((*i).qualifiers.contains(VCARD_TEL_PCS))
type |= PhoneNumber::Pcs;
}
addressee.insertPhoneNumber(PhoneNumber((*i).parameters[0], type));
}
}
// set the addressee's addresses
for(QValueListIterator< VCardLineX > i = vCard->_vcdata->begin(); i != vCard->_vcdata->end(); ++i)
{
if((*i).name == VCARD_ADR)
{
int type = 0;
if((*i).qualified)
{
if((*i).qualifiers.contains(VCARD_ADR_DOM))
type |= Address::Dom;
if((*i).qualifiers.contains(VCARD_ADR_INTL))
type |= Address::Intl;
if((*i).qualifiers.contains(VCARD_ADR_POSTAL))
type |= Address::Postal;
if((*i).qualifiers.contains(VCARD_ADR_PARCEL))
type |= Address::Parcel;
if((*i).qualifiers.contains(VCARD_ADR_HOME))
type |= Address::Home;
if((*i).qualifiers.contains(VCARD_ADR_WORK))
type |= Address::Work;
if((*i).qualifiers.contains(VCARD_ADR_PREF))
type |= Address::Pref;
}
addressee.insertAddress(readAddressFromQStringList((*i).parameters, type));
}
}
// set the addressee's delivery label
tmpStr = vCard->getValue(VCARD_LABEL);
if(!tmpStr.isEmpty())
{
tmpStr.replace("\r\n", "\n");
Address tmpAddress;
tmpAddress.setLabel(tmpStr);
addressee.insertAddress(tmpAddress);
}
// set the addressee's notes
tmpStr = vCard->getValue(VCARD_NOTE);
tmpStr.replace("\r\n", "\n");
addressee.setNote(tmpStr);
// set the addressee's timezone
tmpStr = vCard->getValue(VCARD_TZ);
TimeZone tmpZone(tmpStr.toInt());
addressee.setTimeZone(tmpZone);
// set the addressee's geographical position
tmpList = vCard->getValues(VCARD_GEO);
if(tmpList.count() == 2)
{
tmpStr = tmpList[0];
float glat = tmpStr.toFloat();
tmpStr = tmpList[1];
float glong = tmpStr.toFloat();
Geo tmpGeo(glat, glong);
addressee.setGeo(tmpGeo);
}
// set the last revision date
tmpStr = vCard->getValue(VCARD_REV);
addressee.setRevision(VCardStringToDate(tmpStr));
// set the role of the addressee
tmpStr = vCard->getValue(VCARD_ROLE);
addressee.setRole(tmpStr);
delete vCard;
return addressee;
}
示例5: fromXml
//.........这里部分代码省略.........
else if(element.tagName() == "work_phone_number")
addr.insertPhoneNumber(KABC::PhoneNumber(element.text(), KABC::PhoneNumber::Work));
else if(element.tagName() == "work_fax_number")
addr.insertPhoneNumber(KABC::PhoneNumber(element.text(), KABC::PhoneNumber::Work | KABC::PhoneNumber::Fax));
else if(element.tagName() == "mobile_phone_number")
addr.insertPhoneNumber(KABC::PhoneNumber(element.text(), KABC::PhoneNumber::Cell));
// address (work)
else if(element.tagName() == "work_address_street")
workAddress.setStreet(element.text());
else if(element.tagName() == "work_address_zip")
workAddress.setPostalCode(element.text());
else if(element.tagName() == "work_address_city")
workAddress.setLocality(element.text());
else if(element.tagName() == "work_address_state")
workAddress.setRegion(element.text());
else if(element.tagName() == "work_address_country")
workAddress.setCountry(element.text());
// address (home)
else if(element.tagName() == "home_address_street")
homeAddress.setStreet(element.text());
else if(element.tagName() == "home_address_zip")
homeAddress.setPostalCode(element.text());
else if(element.tagName() == "home_address_city")
homeAddress.setLocality(element.text());
else if(element.tagName() == "home_address_state")
homeAddress.setRegion(element.text());
else if(element.tagName() == "home_address_country")
homeAddress.setCountry(element.text());
// address (other)
else if(element.tagName() == "other_address_street")
otherAddress.setStreet(element.text());
else if(element.tagName() == "other_address_zip")
otherAddress.setPostalCode(element.text());
else if(element.tagName() == "other_address_city")
otherAddress.setLocality(element.text());
else if(element.tagName() == "other_address_state")
otherAddress.setRegion(element.text());
else if(element.tagName() == "other_address_country")
otherAddress.setCountry(element.text());
else if(element.tagName() == "selected_mailing_address")
switch(element.text().toInt())
{
case 1:
homeAddress.setType(homeAddress.type() | KABC::Address::Pref);
break;
case 2:
workAddress.setType(workAddress.type() | KABC::Address::Pref);
break;
case 3:
otherAddress.setType(otherAddress.type() | KABC::Address::Pref);
break;
default:
Q_ASSERT(!"Unknown selected_mailing_address enum");
break;
}
// misc
else if(element.tagName() == "im_address")
addr.insertCustom("KADDRESSBOOK", "X-IMAddress", element.text());
else if(element.tagName() == "manager")
addr.insertCustom("KADDRESSBOOK", "X-ManagersName", element.text());
else if(element.tagName() == "department")
addr.insertCustom("KADDRESSBOOK", "X-Department", element.text());
else if(element.tagName() == "assistant")
addr.insertCustom("KADDRESSBOOK", "X-AssistantsName", element.text());
else if(element.tagName() == "profession")
addr.insertCustom("KADDRESSBOOK", "X-Profession", element.text());
else if(element.tagName() == "office_location")
addr.insertCustom("KADDRESSBOOK", "X-Office", element.text());
else if(element.tagName() == "spouse")
addr.insertCustom("KADDRESSBOOK", "X-SpousesName", element.text());
else if(element.tagName() == "bday")
addr.setBirthday(QDateTime::fromString(element.text(), Qt::ISODate));
else if(element.tagName() == "anniversary")
addr.insertCustom("KADDRESSBOOK", "X-Anniversary", element.text());
else
setCustom(element.tagName(), element.text(), addr);
}
node = node.nextSibling();
}
for(int i = 0; i < 3; ++i)
if(!emails[ i ].isEmpty())
addr.insertEmail(emails[ i ]);
if(!homeAddress.isEmpty())
addr.insertAddress(homeAddress);
if(!workAddress.isEmpty())
addr.insertAddress(workAddress);
if(!otherAddress.isEmpty())
addr.insertAddress(otherAddress);
return addr;
}
示例6: importContacts
KABC::AddresseeList OperaXXPort::importContacts(const QString &) const
{
KABC::AddresseeList addrList;
QString fileName = KFileDialog::getOpenFileName(QDir::homeDirPath() + QString::fromLatin1("/.opera/contacts.adr"));
if(fileName.isEmpty())
return addrList;
QFile file(fileName);
if(!file.open(IO_ReadOnly))
{
QString msg = i18n("<qt>Unable to open <b>%1</b> for reading.</qt>");
KMessageBox::error(parentWidget(), msg.arg(fileName));
return addrList;
}
QTextStream stream(&file);
stream.setEncoding(QTextStream::UnicodeUTF8);
QString line, key, value;
bool parseContact = false;
KABC::Addressee addr;
QRegExp separator("\x02\x02");
while(!stream.atEnd())
{
line = stream.readLine();
line = line.stripWhiteSpace();
if(line == QString::fromLatin1("#CONTACT"))
{
parseContact = true;
addr = KABC::Addressee();
continue;
}
else if(line.isEmpty())
{
parseContact = false;
if(!addr.isEmpty())
{
addrList.append(addr);
addr = KABC::Addressee();
}
continue;
}
if(parseContact == true)
{
int sep = line.find('=');
key = line.left(sep).lower();
value = line.mid(sep + 1);
if(key == QString::fromLatin1("name"))
addr.setNameFromString(value);
else if(key == QString::fromLatin1("mail"))
{
QStringList emails = QStringList::split(separator, value);
QStringList::Iterator it = emails.begin();
bool preferred = true;
for(; it != emails.end(); ++it)
{
addr.insertEmail(*it, preferred);
preferred = false;
}
}
else if(key == QString::fromLatin1("phone"))
addr.insertPhoneNumber(KABC::PhoneNumber(value));
else if(key == QString::fromLatin1("fax"))
addr.insertPhoneNumber(KABC::PhoneNumber(value,
KABC::PhoneNumber::Fax | KABC::PhoneNumber::Home));
else if(key == QString::fromLatin1("postaladdress"))
{
KABC::Address address(KABC::Address::Home);
address.setLabel(value.replace(separator, "\n"));
addr.insertAddress(address);
}
else if(key == QString::fromLatin1("description"))
addr.setNote(value.replace(separator, "\n"));
else if(key == QString::fromLatin1("url"))
addr.setUrl(KURL(value));
else if(key == QString::fromLatin1("pictureurl"))
{
KABC::Picture pic(value);
addr.setPhoto(pic);
}
}
}
file.close();
return addrList;
}
示例7: setFieldText
void CSVTemplate::setFieldText(int column, KABC::Addressee& addressee, const QString& text) const
{
if (column < 0 || text.isEmpty()) return;
if (m_columnToField.isEmpty()) return;
QMap<int, int>::const_iterator it = m_columnToField.find(column);
if (it == m_columnToField.end()) return;
Address address;
PhoneNumber phone;
switch (it.value())
{
case 0: // "Formatted Name"
addressee.setFormattedName(text);
break;
case 1: // "Family Name"
addressee.setFamilyName(text);
break;
case 2: // "Given Name"
addressee.setGivenName(text);
break;
case 3: // "Additional Names"
addressee.setAdditionalName(text);
break;
case 4: // "Honorific Prefixes"
addressee.setPrefix(text);
break;
case 5: // "Honorific Suffixes"
addressee.setSuffix(text);
break;
case 6: // "Nick Name"
addressee.setNickName(text);
break;
case 7: // "Birthday"
addressee.setBirthday(parseDate(text));
break;
case 8: // "Home Address Street"
address = addressee.address(Address::Home);
address.setStreet(text);
addressee.insertAddress(address);
break;
case 9: // "Home Address Locality"
address = addressee.address(Address::Home);
address.setLocality(text);
addressee.insertAddress(address);
break;
case 10: // "Home Address Region"
address = addressee.address(Address::Home);
address.setRegion(text);
addressee.insertAddress(address);
break;
case 11: // "Home Address Postal Code"
address = addressee.address(Address::Home);
address.setPostalCode(text);
addressee.insertAddress(address);
break;
case 12: // "Home Address Country"
address = addressee.address(Address::Home);
address.setCountry(text);
addressee.insertAddress(address);
break;
case 13: // "Home Address Label"
address = addressee.address(Address::Home);
address.setLabel(text);
addressee.insertAddress(address);
break;
case 14: // "Business Address Street"
address = addressee.address(Address::Work);
address.setStreet(text);
addressee.insertAddress(address);
break;
case 15: // "Business Address Locality"
address = addressee.address(Address::Work);
address.setLocality(text);
addressee.insertAddress(address);
break;
case 16: // "Business Address Region"
address = addressee.address(Address::Work);
address.setRegion(text);
addressee.insertAddress(address);
break;
case 17: // "Business Address Postal Code"
address = addressee.address(Address::Work);
address.setPostalCode(text);
addressee.insertAddress(address);
break;
case 18: // "Business Address Country"
address = addressee.address(Address::Work);
address.setCountry(text);
addressee.insertAddress(address);
break;
case 19: // "Business Address Label"
address = addressee.address(Address::Work);
address.setLabel(text);
addressee.insertAddress(address);
break;
case 20: // "Home Phone"
phone = PhoneNumber(text, PhoneNumber::Home);
addressee.insertPhoneNumber(phone);
//.........这里部分代码省略.........
示例8: workAddr
static KABC::Addressee convertLdapAttributesToAddressee( const KLDAP::LdapAttrMap &attrs )
{
KABC::Addressee addr;
// name
if ( !attrs.value( "cn" ).isEmpty() ) {
addr.setNameFromString( asUtf8( attrs["cn"].first() ) );
}
// email
KLDAP::LdapAttrValue lst = attrs["mail"];
KLDAP::LdapAttrValue::ConstIterator it = lst.constBegin();
bool pref = true;
while ( it != lst.constEnd() ) {
addr.insertEmail( asUtf8( *it ), pref );
pref = false;
++it;
}
if ( !attrs.value( "o" ).isEmpty() ) {
addr.setOrganization( asUtf8( attrs[ "o" ].first() ) );
}
if ( addr.organization().isEmpty() && !attrs.value( "Company" ).isEmpty() ) {
addr.setOrganization( asUtf8( attrs[ "Company" ].first() ) );
}
// Address
KABC::Address workAddr( KABC::Address::Work );
if ( !attrs.value( "department" ).isEmpty() ) {
addr.setDepartment( asUtf8( attrs[ "department" ].first() ) );
}
if ( !workAddr.isEmpty() ) {
addr.insertAddress( workAddr );
}
// phone
if ( !attrs.value( "homePhone" ).isEmpty() ) {
KABC::PhoneNumber homeNr = asUtf8( attrs[ "homePhone" ].first() );
homeNr.setType( KABC::PhoneNumber::Home );
addr.insertPhoneNumber( homeNr );
}
if ( !attrs.value( "telephoneNumber" ).isEmpty() ) {
KABC::PhoneNumber workNr = asUtf8( attrs[ "telephoneNumber" ].first() );
workNr.setType( KABC::PhoneNumber::Work );
addr.insertPhoneNumber( workNr );
}
if ( !attrs.value( "facsimileTelephoneNumber" ).isEmpty() ) {
KABC::PhoneNumber faxNr = asUtf8( attrs[ "facsimileTelephoneNumber" ].first() );
faxNr.setType( KABC::PhoneNumber::Fax );
addr.insertPhoneNumber( faxNr );
}
if ( !attrs.value( "mobile" ).isEmpty() ) {
KABC::PhoneNumber cellNr = asUtf8( attrs[ "mobile" ].first() );
cellNr.setType( KABC::PhoneNumber::Cell );
addr.insertPhoneNumber( cellNr );
}
if ( !attrs.value( "pager" ).isEmpty() ) {
KABC::PhoneNumber pagerNr = asUtf8( attrs[ "pager" ].first() );
pagerNr.setType( KABC::PhoneNumber::Pager );
addr.insertPhoneNumber( pagerNr );
}
return addr;
}
示例9: msTNEFToVPart
//.........这里部分代码省略.........
stringProp( tnefMsg, MAPI_TAG_PR_PROFESSION ) );
QString s = tnefMsg->findProp( MAPI_TAG_PR_WEDDING_ANNIVERSARY ).
remove( QChar( '-' ) ).remove( QChar( ':' ) );
if ( !s.isEmpty() ) {
addressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", s );
}
addressee.setUrl( KUrl( sNamedProp( tnefMsg, MAPI_TAG_CONTACT_WEBPAGE ) ) );
// collect parts of Name entry
addressee.setFamilyName( stringProp( tnefMsg, MAPI_TAG_PR_SURNAME ) );
addressee.setGivenName( stringProp( tnefMsg, MAPI_TAG_PR_GIVEN_NAME ) );
addressee.setAdditionalName( stringProp( tnefMsg, MAPI_TAG_PR_MIDDLE_NAME ) );
addressee.setPrefix( stringProp( tnefMsg, MAPI_TAG_PR_DISPLAY_NAME_PREFIX ) );
addressee.setSuffix( stringProp( tnefMsg, MAPI_TAG_PR_GENERATION ) );
addressee.setNickName( stringProp( tnefMsg, MAPI_TAG_PR_NICKNAME ) );
addressee.setRole( stringProp( tnefMsg, MAPI_TAG_PR_TITLE ) );
addressee.setOrganization( stringProp( tnefMsg, MAPI_TAG_PR_COMPANY_NAME ) );
/*
the MAPI property ID of this (multiline) )field is unknown:
vPart += stringProp(tnefMsg, "\n","NOTE", ... , "" );
*/
KABC::Address adr;
adr.setPostOfficeBox( stringProp( tnefMsg, MAPI_TAG_PR_HOME_ADDRESS_PO_BOX ) );
adr.setStreet( stringProp( tnefMsg, MAPI_TAG_PR_HOME_ADDRESS_STREET ) );
adr.setLocality( stringProp( tnefMsg, MAPI_TAG_PR_HOME_ADDRESS_CITY ) );
adr.setRegion( stringProp( tnefMsg, MAPI_TAG_PR_HOME_ADDRESS_STATE_OR_PROVINCE ) );
adr.setPostalCode( stringProp( tnefMsg, MAPI_TAG_PR_HOME_ADDRESS_POSTAL_CODE ) );
adr.setCountry( stringProp( tnefMsg, MAPI_TAG_PR_HOME_ADDRESS_COUNTRY ) );
adr.setType( KABC::Address::Home );
addressee.insertAddress( adr );
adr.setPostOfficeBox( sNamedProp( tnefMsg, MAPI_TAG_CONTACT_BUSINESSADDRESSPOBOX ) );
adr.setStreet( sNamedProp( tnefMsg, MAPI_TAG_CONTACT_BUSINESSADDRESSSTREET ) );
adr.setLocality( sNamedProp( tnefMsg, MAPI_TAG_CONTACT_BUSINESSADDRESSCITY ) );
adr.setRegion( sNamedProp( tnefMsg, MAPI_TAG_CONTACT_BUSINESSADDRESSSTATE ) );
adr.setPostalCode( sNamedProp( tnefMsg, MAPI_TAG_CONTACT_BUSINESSADDRESSPOSTALCODE ) );
adr.setCountry( sNamedProp( tnefMsg, MAPI_TAG_CONTACT_BUSINESSADDRESSCOUNTRY ) );
adr.setType( KABC::Address::Work );
addressee.insertAddress( adr );
adr.setPostOfficeBox( stringProp( tnefMsg, MAPI_TAG_PR_OTHER_ADDRESS_PO_BOX ) );
adr.setStreet( stringProp( tnefMsg, MAPI_TAG_PR_OTHER_ADDRESS_STREET ) );
adr.setLocality( stringProp( tnefMsg, MAPI_TAG_PR_OTHER_ADDRESS_CITY ) );
adr.setRegion( stringProp( tnefMsg, MAPI_TAG_PR_OTHER_ADDRESS_STATE_OR_PROVINCE ) );
adr.setPostalCode( stringProp( tnefMsg, MAPI_TAG_PR_OTHER_ADDRESS_POSTAL_CODE ) );
adr.setCountry( stringProp( tnefMsg, MAPI_TAG_PR_OTHER_ADDRESS_COUNTRY ) );
adr.setType( KABC::Address::Dom );
addressee.insertAddress( adr );
// problem: the 'other' address was stored by KOrganizer in
// a line looking like the following one:
// vPart += "\nADR;TYPE=dom;TYPE=intl;TYPE=parcel;TYPE=postal;TYPE=work;"
// "TYPE=home:other_pobox;;other_str1\nother_str2;other_loc;other_region;"
// "other_pocode;other_country"
QString nr;
nr = stringProp( tnefMsg, MAPI_TAG_PR_HOME_TELEPHONE_NUMBER );
addressee.insertPhoneNumber(
KABC::PhoneNumber( nr, KABC::PhoneNumber::Home ) );
nr = stringProp( tnefMsg, MAPI_TAG_PR_BUSINESS_TELEPHONE_NUMBER );
addressee.insertPhoneNumber(
KABC::PhoneNumber( nr, KABC::PhoneNumber::Work ) );
示例10: filterContacts
KABC::AddresseeList VCardXXPort::filterContacts( const KABC::AddresseeList &addrList )
{
KABC::AddresseeList list;
if ( addrList.isEmpty() )
return addrList;
VCardExportSelectionDialog dlg( parentWidget() );
if ( !dlg.exec() )
return list;
KABC::AddresseeList::ConstIterator it;
for ( it = addrList.begin(); it != addrList.end(); ++it ) {
KABC::Addressee addr;
addr.setUid( (*it).uid() );
addr.setFormattedName( (*it).formattedName() );
addr.setPrefix( (*it).prefix() );
addr.setGivenName( (*it).givenName() );
addr.setAdditionalName( (*it).additionalName() );
addr.setFamilyName( (*it).familyName() );
addr.setSuffix( (*it).suffix() );
addr.setNickName( (*it).nickName() );
addr.setMailer( (*it).mailer() );
addr.setTimeZone( (*it).timeZone() );
addr.setGeo( (*it).geo() );
addr.setProductId( (*it).productId() );
addr.setSortString( (*it).sortString() );
addr.setUrl( (*it).url() );
addr.setSecrecy( (*it).secrecy() );
addr.setSound( (*it).sound() );
addr.setEmails( (*it).emails() );
addr.setCategories( (*it).categories() );
if ( dlg.exportPrivateFields() ) {
addr.setBirthday( (*it).birthday() );
addr.setNote( (*it).note() );
addr.setPhoto( (*it).photo() );
}
if ( dlg.exportBusinessFields() ) {
addr.setTitle( (*it).title() );
addr.setRole( (*it).role() );
addr.setOrganization( (*it).organization() );
addr.setLogo( (*it).logo() );
KABC::PhoneNumber::List phones = (*it).phoneNumbers( KABC::PhoneNumber::Work );
KABC::PhoneNumber::List::Iterator phoneIt;
for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt )
addr.insertPhoneNumber( *phoneIt );
KABC::Address::List addresses = (*it).addresses( KABC::Address::Work );
KABC::Address::List::Iterator addrIt;
for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt )
addr.insertAddress( *addrIt );
}
KABC::PhoneNumber::List phones = (*it).phoneNumbers();
KABC::PhoneNumber::List::Iterator phoneIt;
for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) {
int type = (*phoneIt).type();
if ( type & KABC::PhoneNumber::Home && dlg.exportPrivateFields() )
addr.insertPhoneNumber( *phoneIt );
else if ( type & KABC::PhoneNumber::Work && dlg.exportBusinessFields() )
addr.insertPhoneNumber( *phoneIt );
else if ( dlg.exportOtherFields() )
addr.insertPhoneNumber( *phoneIt );
}
KABC::Address::List addresses = (*it).addresses();
KABC::Address::List::Iterator addrIt;
for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) {
int type = (*addrIt).type();
if ( type & KABC::Address::Home && dlg.exportPrivateFields() )
addr.insertAddress( *addrIt );
else if ( type & KABC::Address::Work && dlg.exportBusinessFields() )
addr.insertAddress( *addrIt );
else if ( dlg.exportOtherFields() )
addr.insertAddress( *addrIt );
}
if ( dlg.exportOtherFields() )
addr.setCustoms( (*it).customs() );
if ( dlg.exportEncryptionKeys() ) {
addKey( addr, KABC::Key::PGP );
addKey( addr, KABC::Key::X509 );
}
list.append( addr );
}
return list;
}