本文整理汇总了C++中kabc::Addressee::setNote方法的典型用法代码示例。如果您正苦于以下问题:C++ Addressee::setNote方法的具体用法?C++ Addressee::setNote怎么用?C++ Addressee::setNote使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kabc::Addressee
的用法示例。
在下文中一共展示了Addressee::setNote方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: toKABC
KABC::Addressee toKABC(const Kolab::Contact &contact)
{
KABC::Addressee addressee;
addressee.setUid(fromStdString(contact.uid()));
addressee.setCategories(toStringList(contact.categories()));
//addressee.setName(fromStdString(contact.name()));//This one is only for compatiblity (and results in a non-existing name property)
addressee.setFormattedName(fromStdString(contact.name())); //This on corresponds to fn
const Kolab::NameComponents &nc = contact.nameComponents();
if (!nc.surnames().empty()) {
addressee.setFamilyName(fromStdString(nc.surnames().front()));
}
if (!nc.given().empty()) {
addressee.setGivenName(fromStdString(nc.given().front()));
}
if (!nc.additional().empty()) {
addressee.setAdditionalName(fromStdString(nc.additional().front()));
}
if (!nc.prefixes().empty()) {
addressee.setPrefix(fromStdString(nc.prefixes().front()));
}
if (!nc.suffixes().empty()) {
addressee.setSuffix(fromStdString(nc.suffixes().front()));
}
addressee.setNote(fromStdString(contact.note()));
addressee.setSecrecy(KABC::Secrecy::Public); //We don't have any privacy setting in xCard
QString preferredEmail;
if (!contact.emailAddresses().empty()) {
QStringList emails;
foreach( const Kolab::Email &email, contact.emailAddresses()) {
emails << fromStdString(email.address());
const QString types = emailTypesToStringList(email.types());
if (!types.isEmpty()) {
addressee.insertCustom(QLatin1String("KOLAB"), QString::fromLatin1("EmailTypes%1").arg(fromStdString(email.address())), types);
}
}
addressee.setEmails(emails);
if ((contact.emailAddressPreferredIndex() >= 0) && (contact.emailAddressPreferredIndex() < static_cast<int>(contact.emailAddresses().size()))) {
preferredEmail = fromStdString(contact.emailAddresses().at(contact.emailAddressPreferredIndex()).address());
} else {
preferredEmail = fromStdString(contact.emailAddresses().at(0).address());
}
addressee.insertEmail(preferredEmail, true);
}
示例2: importContacts
KABC::AddresseeList GMXXXPort::importContacts( const QString& ) const
{
KABC::AddresseeList addrList;
QString fileName = KFileDialog::getOpenFileName( ":xxport_gmx",
GMX_FILESELECTION_STRING, 0 );
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;
}
QDateTime dt;
QTextStream gmxStream( &file );
gmxStream.setEncoding( QTextStream::Latin1 );
QString line, line2;
line = gmxStream.readLine();
line2 = gmxStream.readLine();
if (!line.startsWith("AB_ADDRESSES:") || !line2.startsWith("Address_id")) {
KMessageBox::error( parentWidget(), i18n("%1 is not a GMX address book file.").arg(fileName) );
return addrList;
}
QStringList strList;
typedef QMap<QString, KABC::Addressee *> AddressMap;
AddressMap addrMap;
// "Address_id,Nickname,Firstname,Lastname,Title,Birthday,Comments,Change_date,Status,Address_link_id,Categories"
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).
//.........这里部分代码省略.........
示例3: 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;
}
示例4: 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;
}
示例5: readKMailEntry
void readKMailEntry(const QString &kmailEntry, KABC::AddressBook *ab)
{
kdDebug() << "KMAILENTRY: " << kmailEntry << endl;
QString entry = kmailEntry.simplifyWhiteSpace();
if(entry.isEmpty())
return;
QString email;
QString name;
QString comment;
if(entry.at(entry.length() - 1) == ')')
{
int br = entry.findRev('(');
if(br >= 0)
{
comment = entry.mid(br + 1, entry.length() - br - 2);
entry.truncate(br);
if(entry.at(entry.length() - 1).isSpace())
{
entry.truncate(br - 1);
}
}
}
int posSpace = entry.findRev(' ');
if(posSpace < 0)
{
email = entry;
if(!comment.isEmpty())
{
name = comment;
comment = "";
}
}
else
{
email = entry.mid(posSpace + 1);
name = entry.left(posSpace);
}
if(email.at(0) == '<' && email.at(email.length() - 1) == '>')
{
email = email.mid(1, email.length() - 2);
}
if(name.at(0) == '"' && name.at(name.length() - 1) == '"')
{
name = name.mid(1, name.length() - 2);
}
if(name.at(0) == '\'' && name.at(name.length() - 1) == '\'')
{
name = name.mid(1, name.length() - 2);
}
if(name.at(name.length() - 1) == ')')
{
int br = name.findRev('(');
if(br >= 0)
{
comment = name.mid(br + 1, name.length() - br - 2) + " " + comment;
name.truncate(br);
if(name.at(name.length() - 1).isSpace())
{
name.truncate(br - 1);
}
}
}
kdDebug() << " EMAIL : " << email << endl;
kdDebug() << " NAME : " << name << endl;
kdDebug() << " COMMENT : " << comment << endl;
KABC::Addressee::List al = ab->findByEmail(email);
if(al.isEmpty())
{
KABC::Addressee a;
a.setNameFromString(name);
a.insertEmail(email);
a.setNote(comment);
ab->insertAddressee(a);
kdDebug() << "--INSERTED: " << a.realName() << endl;
}
}
示例6: setFieldText
//.........这里部分代码省略.........
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);
break;
case 21: // "Business Phone"
phone = PhoneNumber(text, PhoneNumber::Work);
addressee.insertPhoneNumber(phone);
break;
case 22: // "Mobile Phone"
phone = PhoneNumber(text, PhoneNumber::Cell);
addressee.insertPhoneNumber(phone);
break;
case 23: // "Home Fax"
phone = PhoneNumber(text, PhoneNumber::Fax | PhoneNumber::Home);
addressee.insertPhoneNumber(phone);
break;
case 24: // "Business Fax"
phone = PhoneNumber(text, PhoneNumber::Fax | PhoneNumber::Work);
addressee.insertPhoneNumber(phone);
break;
case 25: // "Car Phone"
phone = PhoneNumber(text, PhoneNumber::Car);
addressee.insertPhoneNumber(phone);
break;
case 26: // "Isdn"
phone = PhoneNumber(text, PhoneNumber::Isdn);
addressee.insertPhoneNumber(phone);
break;
case 27: // "Pager"
phone = PhoneNumber(text, PhoneNumber::Pager);
addressee.insertPhoneNumber(phone);
break;
case 28: // "Email Address"
addressee.insertEmail(text);
break;
case 29: // "Mail Client"
addressee.setMailer(text);
break;
case 30: // "Title"
addressee.setTitle(text);
break;
case 31: // "Role"
addressee.setRole(text);
break;
case 32: // "Organization"
addressee.setOrganization(text);
break;
case 33: // "Note"
addressee.setNote(text);
break;
case 34: // "URL"
addressee.setUrl(text);
break;
case 35: // "Department"
break;
case 36: // "Profession"
break;
case 37: // "Assistant's Name"
break;
case 38: // "Manager's Name"
break;
case 39: // "Spouse's Name"
break;
case 40: // "Office"
break;
case 41: // "IM Address"
break;
case 42: // "Anniversary"
break;
default:
break;
}
}
示例7: setNote
static void setNote(const QString &value, KABC::Addressee &addressee)
{
addressee.setNote(value);
}
示例8: 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;
}