本文整理汇总了C++中kabc::Addressee::birthday方法的典型用法代码示例。如果您正苦于以下问题:C++ Addressee::birthday方法的具体用法?C++ Addressee::birthday怎么用?C++ Addressee::birthday使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kabc::Addressee
的用法示例。
在下文中一共展示了Addressee::birthday方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: entityData
QVariant ContactsTreeModel::entityData( const Item &item, int column, int role ) const
{
if ( item.mimeType() == KABC::Addressee::mimeType() ) {
if ( !item.hasPayload<KABC::Addressee>() ) {
// Pass modeltest
if ( role == Qt::DisplayRole )
return item.remoteId();
return QVariant();
}
const KABC::Addressee contact = item.payload<KABC::Addressee>();
if ( role == Qt::DecorationRole ) {
if ( column == 0 ) {
const KABC::Picture picture = contact.photo();
if ( picture.isIntern() ) {
return picture.data().scaled( QSize( 16, 16 ), Qt::KeepAspectRatio );
} else {
return KIcon( QLatin1String( "x-office-contact" ) );
}
}
return QVariant();
} else if ( (role == Qt::DisplayRole) || (role == Qt::EditRole) ) {
switch ( mColumns.at( column ) ) {
case FullName:
return contact.realName();
break;
case Birthday:
if ( contact.birthday().isValid() )
return KGlobal::locale()->formatDate( contact.birthday().date() );
break;
case HomeAddress:
{
const KABC::Address address = contact.address( KABC::Address::Home );
if ( !address.isEmpty() )
return address.formattedAddress();
}
break;
case BusinessAddress:
{
const KABC::Address address = contact.address( KABC::Address::Work );
if ( !address.isEmpty() )
return address.formattedAddress();
}
break;
case PhoneNumbers:
{
QStringList values;
const KABC::PhoneNumber::List numbers = contact.phoneNumbers();
foreach ( const KABC::PhoneNumber &number, numbers )
values += number.number();
return values.join( "\n" );
}
break;
case PreferredEmail:
return contact.preferredEmail();
break;
case AllEmails:
return contact.emails().join( "\n" );
break;
case Organization:
return contact.organization();
break;
case Homepage:
return contact.url().url();
break;
case Note:
return contact.note();
break;
}
}
} else if ( item.mimeType() == KABC::ContactGroup::mimeType() ) {
示例2: 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();
}
//.........这里部分代码省略.........
示例3: fieldText
QString CSVTemplate::fieldText(int column, const KABC::Addressee& addressee) const
{
if (column < 0 || addressee.isEmpty()) return QString();
if (m_columnToField.isEmpty()) return QString();
QMap<int, int>::const_iterator it = m_columnToField.find(column);
if (it == m_columnToField.end()) return QString();
QString text;
switch (it.value())
{
case 0: // "Formatted Name"
text = addressee.formattedName();
break;
case 1: // "Family Name"
text = addressee.familyName();
break;
case 2: // "Given Name"
text = addressee.givenName();
break;
case 3: // "Additional Names"
text = addressee.additionalName();
break;
case 4: // "Honorific Prefixes"
text = addressee.prefix();
break;
case 5: // "Honorific Suffixes"
text = addressee.suffix();
break;
case 6: // "Nick Name"
text = addressee.nickName();
break;
case 7: // "Birthday"
text = formatDate(addressee.birthday());
break;
case 8: // "Home Address Street"
text = addressee.address(Address::Home).street();
break;
case 9: // "Home Address Locality"
text = addressee.address(Address::Home).locality();
break;
case 10: // "Home Address Region"
text = addressee.address(Address::Home).region();
break;
case 11: // "Home Address Postal Code"
text = addressee.address(Address::Home).postalCode();
break;
case 12: // "Home Address Country"
text = addressee.address(Address::Home).country();
break;
case 13: // "Home Address Label"
text = addressee.address(Address::Home).label();
break;
case 14: // "Business Address Street"
text = addressee.address(Address::Work).street();
break;
case 15: // "Business Address Locality"
text = addressee.address(Address::Work).locality();
break;
case 16: // "Business Address Region"
text = addressee.address(Address::Work).region();
break;
case 17: // "Business Address Postal Code"
text = addressee.address(Address::Work).postalCode();
break;
case 18: // "Business Address Country"
text = addressee.address(Address::Work).country();
break;
case 19: // "Business Address Label"
text = addressee.address(Address::Work).label();
break;
case 20: // "Home Phone"
text = addressee.phoneNumber(PhoneNumber::Home).number();
break;
case 21: // "Business Phone"
text = addressee.phoneNumber(PhoneNumber::Work).number();
break;
case 22: // "Mobile Phone"
text = addressee.phoneNumber(PhoneNumber::Cell).number();
break;
case 23: // "Home Fax"
text = addressee.phoneNumber(PhoneNumber::Fax | PhoneNumber::Home).number();
break;
case 24: // "Business Fax"
text = addressee.phoneNumber(PhoneNumber::Fax | PhoneNumber::Work).number();
break;
case 25: // "Car Phone"
text = addressee.phoneNumber(PhoneNumber::Car).number();
break;
case 26: // "Isdn"
text = addressee.phoneNumber(PhoneNumber::Isdn).number();
break;
case 27: // "Pager"
text = addressee.phoneNumber(PhoneNumber::Pager).number();
break;
case 28: // "Email Address"
text = addressee.preferredEmail();
break;
case 29: // "Mail Client"
text = addressee.mailer();
//.........这里部分代码省略.........
示例4: toXml
//.........这里部分代码省略.........
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);
xml += "<home_address_street>" + homeAddress.street() + "</home_address_street>\n";
xml += "<home_address_zip>" + homeAddress.postalCode() + "</home_address_zip>\n";
xml += "<home_address_city>" + homeAddress.locality() + "</home_address_city>\n";
xml += "<home_address_state>" + homeAddress.region() + "</home_address_state>\n";
xml += "<home_address_country>" + homeAddress.country() + "</home_address_country>\n";
const KABC::Address otherAddress = addr.address(KABC::Address::Dom);
xml += "<other_address_street>" + otherAddress.street() + "</other_address_street>\n";
xml += "<other_address_zip>" + otherAddress.postalCode() + "</other_address_zip>\n";
xml += "<other_address_city>" + otherAddress.locality() + "</other_address_city>\n";
xml += "<other_address_state>" + otherAddress.region() + "</other_address_state>\n";
xml += "<other_address_country>" + otherAddress.country() + "</other_address_country>\n";
if(homeAddress.type() & KABC::Address::Pref)
xml += "<selected_mailing_address>1</selected_mailing_address>\n";
else if(workAddress.type() & KABC::Address::Pref)
xml += "<selected_mailing_address>2</selected_mailing_address>\n";
else if(otherAddress.type() & KABC::Address::Pref)
xml += "<selected_mailing_address>3</selected_mailing_address>\n";
xml += "<im_address>" + addr.custom("KADDRESSBOOK", "X-IMAddress") + "</im_address>\n";
xml += "<manager>" + addr.custom("KADDRESSBOOK", "X-ManagersName") + "</manager>\n";
xml += "<department>" + addr.custom("KADDRESSBOOK", "X-Department") + "</department>\n";
xml += "<assistant>" + addr.custom("KADDRESSBOOK", "X-AssistantsName") + "</assistant>\n";
xml += "<profession>" + addr.custom("KADDRESSBOOK", "X-Profession") + "</profession>\n";
xml += "<office_location>" + addr.custom("KADDRESSBOOK", "X-Office") + "</office_location>\n";
xml += "<spouse>" + addr.custom("KADDRESSBOOK", "X-SpousesName") + "</spouse>\n";
xml += "<bday>" + addr.birthday().toString(Qt::ISODate) + "</bday>\n";
xml += "<anniversary>" + addr.custom("KADDRESSBOOK", "X-Anniversary") + "</anniversary>\n";
xml += "<mapi_charset>" + custom("mapi_charset", addr, "UTF8") + "</mapi_charset>";
xml += "</contact>\n";
return xml;
}
示例5: getBirthday
static QString getBirthday(const KABC::Addressee &addressee)
{
return KDCRMUtils::dateToString(addressee.birthday().date());
}