本文整理汇总了C++中kabc::Address::type方法的典型用法代码示例。如果您正苦于以下问题:C++ Address::type方法的具体用法?C++ Address::type怎么用?C++ Address::type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kabc::Address
的用法示例。
在下文中一共展示了Address::type方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateAddressEdits
void AddressEditDialog::updateAddressEdits()
{
if ( mPreviousAddress )
saveAddress( *mPreviousAddress );
KABC::Address::List::Iterator it = mTypeCombo->selectedElement();
KABC::Address a = *it;
mPreviousAddress = &(*it);
bool tmp = mChanged;
mStreetTextEdit->setText( a.street() );
mRegionEdit->setText( a.region() );
mLocalityEdit->setText( a.locality() );
mPostalCodeEdit->setText( a.postalCode() );
mPOBoxEdit->setText( a.postOfficeBox() );
mCountryCombo->setCurrentText( a.country() );
mLabel = a.label();
mPreferredCheckBox->setChecked( a.type() & KABC::Address::Pref );
if ( a.isEmpty() )
mCountryCombo->setCurrentText( KGlobal::locale()->twoAlphaToCountryName( KGlobal::locale()->country() ) );
mStreetTextEdit->setFocus();
mChanged = tmp;
}
示例2: fixPreferredAddress
void AddressEditWidget::fixPreferredAddress( const KABC::Address &preferredAddress )
{
// as the preferred address is mutual exclusive, we have to
// remove the flag from all other addresses
if ( preferredAddress.type() & KABC::Address::Pref ) {
for ( int i = 0; i < mAddressList.count(); ++i ) {
KABC::Address &address = mAddressList[ i ];
address.setType( address.type() & ~KABC::Address::Pref );
}
}
}
示例3: saveAddress
void AddressEditDialog::saveAddress( KABC::Address &addr )
{
addr.setLocality( mLocalityEdit->text() );
addr.setRegion( mRegionEdit->text() );
addr.setPostalCode( mPostalCodeEdit->text() );
addr.setCountry( mCountryCombo->currentText() );
addr.setPostOfficeBox( mPOBoxEdit->text() );
addr.setStreet( mStreetTextEdit->text() );
addr.setLabel( mLabel );
if ( mPreferredCheckBox->isChecked() ) {
KABC::Address::List::Iterator it;
for ( it = mAddressList.begin(); it != mAddressList.end(); ++it )
(*it).setType( (*it).type() & ~( KABC::Address::Pref ) );
addr.setType( addr.type() | KABC::Address::Pref );
} else
addr.setType( addr.type() & ~( KABC::Address::Pref ) );
}
示例4: updateAddressEdit
void AddressEditWidget::updateAddressEdit()
{
KABC::Address::List::Iterator it = mTypeCombo->selectedElement();
bool block = signalsBlocked();
blockSignals( true );
mAddressField->setText( "" );
if ( it != mAddressList.end() ) {
KABC::Address a = *it;
if ( !a.isEmpty() ) {
#if KDE_VERSION >= 319
if ( a.type() & KABC::Address::Work && mAddressee.realName() != mAddressee.organization() ) {
mAddressField->setText( a.formattedAddress( mAddressee.realName(),
mAddressee.organization() ) );
} else {
mAddressField->setText( a.formattedAddress( mAddressee.realName() ) );
}
#else
QString text;
if ( !a.street().isEmpty() )
text += a.street() + "\n";
if ( !a.postOfficeBox().isEmpty() )
text += a.postOfficeBox() + "\n";
text += a.locality() + QString(" ") + a.region();
if ( !a.postalCode().isEmpty() )
text += QString(", ") + a.postalCode();
text += "\n";
if ( !a.country().isEmpty() )
text += a.country() + "\n";
text += a.extended();
mAddressField->setText( text );
#endif
}
}
blockSignals( block );
}
示例5: toXml
QString Contact::toXml(const KABC::Addressee &addr)
{
/**
* Handle distribution lists.
*/
if(KPIM::DistributionList::isDistributionList(addr))
{
if(s_distListMap)
return (*s_distListMap)[ addr.uid() ];
else
return QString();
}
/**
* Handle normal contacts.
*/
QString xml;
xml += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
xml += "<contact>\n";
xml += "<direct_ref>" + addr.uid() + "</direct_ref>\n";
xml += "<sensitivity>" + custom("sensitivity", addr, "0") + "</sensitivity>\n";
xml += "<message_class>IPM.Contact</message_class>\n";
xml += "<is_recurring>" + custom("is_recurring", addr, "false") + "</is_recurring>\n";
xml += "<reminder_set>" + custom("reminder_set", addr, "false") + "</reminder_set>\n";
xml += "<send_rich_info>" + custom("send_rich_info", addr, "false") + "</send_rich_info>\n";
xml += "<subject>" + addr.formattedName() + "</subject>\n";
xml += "<last_modification_time>" + addr.revision().toString(Qt::ISODate) + "</last_modification_time>\n";
xml += "<display_name_prefix>" + addr.prefix() + "</display_name_prefix>\n";
xml += "<first_name>" + addr.givenName() + "</first_name>\n";
xml += "<middle_name>" + addr.additionalName() + "</middle_name>\n";
xml += "<last_name>" + addr.familyName() + "</last_name>\n";
xml += "<suffix>" + addr.suffix() + "</suffix>\n";
xml += "<display_name>" + addr.assembledName() + "</display_name>\n";
xml += "<file_as>" + addr.formattedName() + "</file_as>\n";
xml += "<nickname>" + addr.nickName() + "</nickname>\n";
xml += "<web_page_address>" + addr.url().url() + "</web_page_address>\n";
xml += "<company_name>" + addr.organization() + "</company_name>\n";
xml += "<job_title>" + addr.title() + "</job_title>\n";
QStringList emails = addr.emails();
for(uint i = 0; i < 3; ++i)
{
QString type, address, comment, display;
if(i < emails.count())
{
type = "SMTP";
address = emails[ i ];
/**
* If the contact was created by kontact use the email address as
* display name and the formatted name as comment, otherwise we use
* the values from the server.
*/
if(custom("comes_from_scalix", addr) != "true")
{
comment = addr.formattedName();
display = emails[ i ];
}
else
{
comment = custom(QString("email%1_address_with_comment").arg(i + 1), addr);
display = custom(QString("email%1_display_name").arg(i + 1), addr);
}
}
xml += QString("<email%1_address_type>").arg(i + 1) + type +
QString("</email%1_address_type>").arg(i + 1) + "\n";
xml += QString("<email%1_address>").arg(i + 1) + address +
QString("</email%1_address>").arg(i + 1) + "\n";
xml += QString("<email%1_address_with_comment>").arg(i + 1) + comment +
QString("</email%1_address_with_comment>").arg(i + 1) + "\n";
xml += QString("<email%1_display_name>").arg(i + 1) + display +
QString("</email%1_display_name>").arg(i + 1) + "\n";
}
KABC::PhoneNumber phone = addr.phoneNumber(KABC::PhoneNumber::Home);
xml += "<home_phone_number>" + phone.number() + "</home_phone_number>\n";
phone = addr.phoneNumber(KABC::PhoneNumber::Work);
xml += "<work_phone_number>" + phone.number() + "</work_phone_number>\n";
phone = addr.phoneNumber(KABC::PhoneNumber::Work | KABC::PhoneNumber::Fax);
xml += "<work_fax_number>" + phone.number() + "</work_fax_number>\n";
phone = addr.phoneNumber(KABC::PhoneNumber::Cell);
xml += "<mobile_phone_number>" + phone.number() + "</mobile_phone_number>\n";
const KABC::Address workAddress = addr.address(KABC::Address::Work);
xml += "<work_address_street>" + workAddress.street() + "</work_address_street>\n";
xml += "<work_address_zip>" + workAddress.postalCode() + "</work_address_zip>\n";
xml += "<work_address_city>" + workAddress.locality() + "</work_address_city>\n";
xml += "<work_address_state>" + workAddress.region() + "</work_address_state>\n";
xml += "<work_address_country>" + workAddress.country() + "</work_address_country>\n";
const KABC::Address homeAddress = addr.address(KABC::Address::Home);
//.........这里部分代码省略.........