本文整理汇总了C++中kabc::Addressee::setPhoto方法的典型用法代码示例。如果您正苦于以下问题:C++ Addressee::setPhoto方法的具体用法?C++ Addressee::setPhoto怎么用?C++ Addressee::setPhoto使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kabc::Addressee
的用法示例。
在下文中一共展示了Addressee::setPhoto方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}