本文整理汇总了C++中kabc::Address::region方法的典型用法代码示例。如果您正苦于以下问题:C++ Address::region方法的具体用法?C++ Address::region怎么用?C++ Address::region使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kabc::Address
的用法示例。
在下文中一共展示了Address::region方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createUrl
QString LocationMap::createUrl( const KABC::Address &addr )
{
/**
This method makes substitutions for the following place holders:
%s street
%r region
%l locality
%z zip code
%c country (in ISO format)
*/
QString urlTemplate = KABPrefs::instance()->locationMapURL().arg( KGlobal::locale()->country() );
if ( urlTemplate.isEmpty() ) {
KMessageBox::error( 0, i18n( "No service provider available for map lookup!\nPlease add one in the configuration dialog." ) );
return QString::null;
}
#if KDE_VERSION >= 319
return urlTemplate.replace( "%s", addr.street() ).
replace( "%r", addr.region() ).
replace( "%l", addr.locality() ).
replace( "%z", addr.postalCode() ).
replace( "%c", addr.countryToISO( addr.country() ) );
#else
return urlTemplate.replace( "%s", addr.street() ).
replace( "%r", addr.region() ).
replace( "%l", addr.locality() ).
replace( "%z", addr.postalCode() ).
replace( "%c", "" );
#endif
}
示例2: 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;
}
示例3: contactToTemplate
void ReportGenerator::contactToTemplate( TextTemplate *tmpl, const QString& prefix, const KABC::Addressee& contact )
{
if( contact.isEmpty() ) return;
tmpl->setValue( ADDRESS_TAG( prefix, "NAME" ), escapeTrml2pdfXML( contact.realName() ) );
QString co = contact.organization();
if( co.isEmpty() ) {
co = contact.realName();
}
tmpl->setValue( ADDRESS_TAG( prefix, "ORGANISATION" ), escapeTrml2pdfXML( co ) );
tmpl->setValue( ADDRESS_TAG( prefix, "URL" ), escapeTrml2pdfXML( contact.url().prettyUrl() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "EMAIL" ), escapeTrml2pdfXML( contact.preferredEmail() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "PHONE" ), escapeTrml2pdfXML( contact.phoneNumber( KABC::PhoneNumber::Work ).number() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "FAX" ), escapeTrml2pdfXML( contact.phoneNumber( KABC::PhoneNumber::Fax ).number() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "CELL" ), escapeTrml2pdfXML( contact.phoneNumber( KABC::PhoneNumber::Cell ).number() ) );
KABC::Address address;
address = contact.address( KABC::Address::Pref );
if( address.isEmpty() )
address = contact.address(KABC::Address::Work );
if( address.isEmpty() )
address = contact.address(KABC::Address::Home );
if( address.isEmpty() )
address = contact.address(KABC::Address::Postal );
tmpl->setValue( ADDRESS_TAG( prefix, "POSTBOX" ),
escapeTrml2pdfXML( address.postOfficeBox() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "EXTENDED" ),
escapeTrml2pdfXML( address.extended() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "STREET" ),
escapeTrml2pdfXML( address.street() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "LOCALITY" ),
escapeTrml2pdfXML( address.locality() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "REGION" ),
escapeTrml2pdfXML( address.region() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "POSTCODE" ),
escapeTrml2pdfXML( address.postalCode() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "COUNTRY" ),
escapeTrml2pdfXML( address.country() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "REGION" ),
escapeTrml2pdfXML( address.region() ) );
tmpl->setValue( ADDRESS_TAG( prefix,"LABEL" ),
escapeTrml2pdfXML( address.label() ) );
}
示例4: fieldName
void KABC::ResourceSlox::createAddressFields( QDomDocument &doc, QDomElement &parent,
const QString &prefix, const KABC::Address &addr )
{
WebdavHandler::addSloxElement( this, doc, parent, prefix + fieldName( Street ), addr.street() );
WebdavHandler::addSloxElement( this, doc, parent, prefix + fieldName( PostalCode ), addr.postalCode() );
WebdavHandler::addSloxElement( this, doc, parent, prefix + fieldName( City ), addr.locality() );
WebdavHandler::addSloxElement( this, doc, parent, prefix + fieldName( State ), addr.region() );
WebdavHandler::addSloxElement( this, doc, parent, prefix + fieldName( Country ), addr.country() );
}
示例5: 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 );
}
示例6: getValue
QString KWMailMergeKABC::getValue( const QString &name, int record ) const
{
kdDebug() << "KWMailMergeKABC::getValue(" << name << ", " << record << ")" << endl;
if ( record < 0 )
return name;
// This doesn't ever happen, right? So why is it there? Dirk Schmidt
if ( record == -1 && _iterator == _addressBook->end() )
return "";
//
// Set the iterator to the asked Addressee.
//
bool uidAvailable = false;
if ( record != -1 )
{
int counter = 0;
for ( _UIDIterator = _exclusiveUIDs.begin(); _UIDIterator != _exclusiveUIDs.end()
&& counter < record; _UIDIterator++ )
{
counter++;
}
for ( _iterator = _addressBook->begin(); _iterator != _addressBook->end(); ++_iterator )
{
if( _iterator->uid() == *_UIDIterator )
{
uidAvailable = true;
break;
}
}
}
if( !uidAvailable )
{
return ( i18n ( "KAddressbook entry '%1' not available." ).arg( *_UIDIterator ) );
}
KABC::Addressee addr = *_iterator;
_iterator++; // Don't know why. Could be removed? Dirk Schmidt
//
// Return the asked variable.
//
if ( name == "KAddressbook identifier" )
return addr.uid();
if ( name == "Name" )
return addr.name();
if ( name == "Formatted name" )
return addr.formattedName();
if ( name == "Family names" )
return addr.familyName();
if ( name == "Given name" )
return addr.givenName();
if ( name == "Additional names" )
return addr.additionalName();
if ( name == "Honorific prefixes" )
return addr.prefix();
if ( name == "Honorific suffixes" )
return addr.suffix();
if ( name == "Nick name" )
return addr.nickName();
if ( name == "Birthday" )
return KGlobal::locale()->formatDate( addr.birthday().date() );
if ( name == "Home address: Street" )
{
KABC::Address a = addr.address( KABC::Address::Home );
return a.street();
}
if ( name == "Home address: Locality" )
{
KABC::Address a = addr.address( KABC::Address::Home );
return a.locality();
}
if ( name == "Home address: Region" )
{
KABC::Address a = addr.address( KABC::Address::Home );
return a.region();
}
if ( name == "Home address: Postal code" )
{
KABC::Address a = addr.address( KABC::Address::Home );
return a.postalCode();
}
if ( name == "Home address: Country" )
{
KABC::Address a = addr.address( KABC::Address::Home );
return a.country();
}
if ( name == "Home address: Label" )
{
KABC::Address a = addr.address( KABC::Address::Home );
return a.label();
}
//.........这里部分代码省略.........
示例7: 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);
//.........这里部分代码省略.........
示例8: parseAddressTemplateSection
/**
Parses a snippet of an address template
@param tsection the template string to be parsed
@param result QString reference in which the result will be stored
@return true if at least one tag evaluated positively, else false
*/
static bool parseAddressTemplateSection( const QString &tsection, QString &result,
const QString &realName, const QString &orgaName,
const KABC::Address &address )
{
// This method first parses and substitutes any bracketed sections and
// after that replaces any tags with their values. If a bracketed section
// or a tag evaluate to zero, they are not just removed but replaced
// with a placeholder. This is because in the last step conditionals are
// resolved which depend on information about zero-evaluations.
result = tsection;
int stpos = 0;
bool ret = false;
// first check for brackets that have to be evaluated first
int fpos = result.indexOf( KABC_FMTTAG_purgeempty, stpos );
while ( -1 != fpos ) {
int bpos1 = fpos + KABC_FMTTAG_purgeempty.length();
int bpos2;
// expect opening bracket and find next balanced closing bracket. If
// next char is no opening bracket, continue parsing (no valid tag)
if ( QLatin1Char( '(' ) == result[bpos1] ) {
bpos2 = findBalancedBracket( result, bpos1 );
if ( -1 != bpos2 ) {
// we have balanced brackets, recursively parse:
QString rplstr;
bool purge = !parseAddressTemplateSection( result.mid( bpos1+1,
bpos2-bpos1-1 ), rplstr,
realName, orgaName, address );
if ( purge ) {
// purge -> remove all
// replace with !_P_!, so conditional tags work later
result.replace( fpos, bpos2 - fpos + 1, QLatin1String( "!_P_!" ) );
// leave stpos as it is
} else {
// no purge -> replace with recursively parsed string
result.replace( fpos, bpos2 - fpos + 1, rplstr );
ret = true;
stpos = fpos + rplstr.length();
}
} else {
// unbalanced brackets: keep on parsing (should not happen
// and will result in bad formatting)
stpos = bpos1;
}
}
fpos = result.indexOf( KABC_FMTTAG_purgeempty, stpos );
}
// after sorting out all purge tags, we just search'n'replace the rest,
// keeping track of whether at least one tag evaluates to something.
// The following macro needs QString for R_FIELD
// It substitutes !_P_! for empty fields so conditional tags work later
#define REPLTAG(R_TAG,R_FIELD) \
if ( result.indexOf( R_TAG, false ) != -1 ) { \
QString rpl = R_FIELD.isEmpty() ? QLatin1String( "!_P_!" ) : R_FIELD; \
result.replace( R_TAG, rpl ); \
if ( !R_FIELD.isEmpty() ) { \
ret = true; \
} \
}
REPLTAG( KABC_FMTTAG_realname, realName );
REPLTAG( KABC_FMTTAG_REALNAME, realName.toUpper() );
REPLTAG( KABC_FMTTAG_company, orgaName );
REPLTAG( KABC_FMTTAG_COMPANY, orgaName.toUpper() );
REPLTAG( KABC_FMTTAG_pobox, address.postOfficeBox() );
REPLTAG( KABC_FMTTAG_street, address.street() );
REPLTAG( KABC_FMTTAG_STREET, address.street().toUpper() );
REPLTAG( KABC_FMTTAG_zipcode, address.postalCode() );
REPLTAG( KABC_FMTTAG_location, address.locality() );
REPLTAG( KABC_FMTTAG_LOCATION, address.locality().toUpper() );
REPLTAG( KABC_FMTTAG_region, address.region() );
REPLTAG( KABC_FMTTAG_REGION, address.region().toUpper() );
result.replace( KABC_FMTTAG_newline, QLatin1String( "\n" ) );
#undef REPLTAG
// conditional comma
fpos = result.indexOf( KABC_FMTTAG_condcomma, 0 );
while ( -1 != fpos ) {
const QString str1 = result.mid( fpos - 5, 5 );
const QString str2 = result.mid( fpos + 2, 5 );
if ( str1 != QLatin1String( "!_P_!" ) && str2 != QLatin1String( "!_P_!" ) ) {
result.replace( fpos, 2, QLatin1String( ", " ) );
} else {
result.remove( fpos, 2 );
}
fpos = result.indexOf( KABC_FMTTAG_condcomma, fpos );
}
// conditional whitespace
fpos = result.indexOf( KABC_FMTTAG_condwhite, 0 );
while ( -1 != fpos ) {
const QString str1 = result.mid( fpos - 5, 5 );
const QString str2 = result.mid( fpos + 2, 5 );
if ( str1 != QLatin1String( "!_P_!" ) && str2 != QLatin1String( "!_P_!" ) ) {
result.replace( fpos, 2, QLatin1String( " " ) );
//.........这里部分代码省略.........