本文整理汇总了C++中kabc::Addressee::setUid方法的典型用法代码示例。如果您正苦于以下问题:C++ Addressee::setUid方法的具体用法?C++ Addressee::setUid怎么用?C++ Addressee::setUid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kabc::Addressee
的用法示例。
在下文中一共展示了Addressee::setUid方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotReadJobData
void ResourceGroupwise::slotReadJobData( KIO::Job *job , const QByteArray &data )
{
kdDebug() << "ResourceGroupwise::slotReadJobData()" << endl;
Q_UNUSED( job );
mJobData.append( data.data() );
KABC::VCardConverter conv;
QTime profile;
profile.start();
Addressee::List addressees = conv.parseVCards( mJobData );
// kdDebug() << " parsed " << addressees.count() << " contacts in " << profile.elapsed() << "ms, now adding to resource..." << endl;
Addressee::List::ConstIterator it;
for( it = addressees.begin(); it != addressees.end(); ++it ) {
KABC::Addressee addr = *it;
if ( !addr.isEmpty() ) {
addr.setResource( this );
QString remote = addr.custom( "GWRESOURCE", "UID" );
QString local = idMapper().localId( remote );
if ( local.isEmpty() ) {
idMapper().setRemoteId( addr.uid(), remote );
} else {
addr.setUid( local );
}
insertAddressee( addr );
clearChange( addr );
}
}
mJobData = QString::null;
}
示例2: testContactConversion_data
void KCalConversionTest::testContactConversion_data()
{
QTest::addColumn<KABC::Addressee>( "kcal" );
QTest::addColumn<Kolab::Contact>( "kolab" );
Kolab::cDateTime date(2011,2,2,12,11,10,true);
Kolab::cDateTime date2(2011,2,2,12,12,10,true);
{
KABC::Addressee kcal;
kcal.setUid("uid");
kcal.setFormattedName("name");
Kolab::Contact kolab;
kolab.setUid("uid");
kolab.setName("name");
QTest::newRow("basic") << kcal << kolab;
}
{
KABC::Addressee kcal;
kcal.setUid("uid");
//The first address is always the preferred
kcal.setEmails(QStringList() << "[email protected]" << "[email protected]");
kcal.insertCustom("KOLAB", "[email protected]", "home,work");
Kolab::Contact kolab;
kolab.setUid("uid");
Kolab::Email email1("[email protected]", Kolab::Email::Work|Kolab::Email::Home);
Kolab::Email email2("[email protected]");
std::vector<Kolab::Email> emails;
emails.push_back(email1);
emails.push_back(email2);
kolab.setEmailAddresses(emails, 0);
QTest::newRow("emailTypesAndPreference") << kcal << kolab;
}
}
示例3: slotUpdateJobData
void ResourceGroupwise::slotUpdateJobData( KIO::Job *job, const QByteArray &data )
{
kdDebug() << "ResourceGroupwise::slotUpdateJobData()" << endl;
kdDebug() << " Job address: " << job << endl;
KABC::VCardConverter conv;
mJobData.append( data.data() );
Addressee::List addressees = conv.parseVCards( mJobData );
Addressee::List::ConstIterator it;
for( it = addressees.begin(); it != addressees.end(); ++it ) {
KABC::Addressee addr = *it;
if ( !addr.isEmpty() ) {
// if added or changed
QString syncType = addr.custom( "GWRESOURCE", "SYNC" );
QString remote = addr.custom( "GWRESOURCE", "UID" );
QString local = idMapper().localId( remote );
if ( syncType == "ADD" || syncType == "UPD" )
{
addr.setResource( this );
if ( local.isEmpty() ) {
idMapper().setRemoteId( addr.uid(), remote );
} else {
addr.setUid( local );
}
insertAddressee( addr );
clearChange( addr );
}
else if ( syncType == "DEL" )
{
// if deleted
if ( !remote.isEmpty() )
{
if ( !local.isEmpty() )
{
idMapper().removeRemoteId( remote );
KABC::Addressee addrToDelete = findByUid( local );
removeAddressee( addrToDelete );
}
}
else
kdError() << "Addressee to delete did not have a remote UID, unable to find the corresponding local contact" << endl;
}
}
}
mJobData = QString::null;
}
示例4: 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);
}
示例5: fakeAddresseeListFromDevice
void AddressbookHandler::fakeAddresseeListFromDevice( KABC::Addressee::List &mAddresseeList, QValueList<uint32_t> &idList )
{
for ( QValueList<uint32_t>::const_iterator it = idList.begin(); it != idList.end(); ++it ) {
KABC::Addressee addr;
QString konId = "RRA-ID-" + QString::number( *it, 16 ).rightJustify( 8, '0' );
QString kdeId;
if ((kdeId = mUidHelper->kdeId("SynCEAddressbook", konId, "---")) != "---") {
addr.setUid(kdeId);
mUidHelper->removeId("SynCEAddressbook", addr.uid());
mAddresseeList.push_back( addr );
}
kdDebug(2120) << "Contact: " << konId << " -- " << kdeId << endl;
}
}
示例6: itemFromEntry
Akonadi::Item ContactsHandler::itemFromEntry(const KDSoapGenerated::TNS__Entry_value &entry, const Akonadi::Collection &parentCollection)
{
Akonadi::Item item;
const QList<KDSoapGenerated::TNS__Name_value> valueList = entry.name_value_list().items();
if (valueList.isEmpty()) {
kWarning() << "Contacts entry for id=" << entry.id() << "has no values";
return item;
}
item.setRemoteId(entry.id());
item.setParentCollection(parentCollection);
item.setMimeType(KABC::Addressee::mimeType());
KABC::Addressee addressee;
addressee.setUid(entry.id());
KABC::Address workAddress, homeAddress;
workAddress.setType(KABC::Address::Work | KABC::Address::Pref);
homeAddress.setType(KABC::Address::Home);
Q_FOREACH (const KDSoapGenerated::TNS__Name_value &namedValue, valueList) {
const ContactAccessorHash::const_iterator accessIt = mAccessors->constFind(namedValue.name());
if (accessIt == mAccessors->constEnd()) {
// no accessor for field
continue;
}
const QString value = KDCRMUtils::decodeXML(namedValue.value());
if (isAddressValue(namedValue.name())) {
KABC::Address &address =
isPrimaryAddressValue(namedValue.name()) ? workAddress : homeAddress;
(*accessIt)->setter.aSetter(value, address);
} else {
(*accessIt)->setter.vSetter(value, addressee);
}
}
addressee.insertAddress(workAddress);
addressee.insertAddress(homeAddress);
item.setPayload<KABC::Addressee>(addressee);
item.setRemoteRevision(getDateModified(addressee));
return item;
}
示例7: kWarning
Akonadi::Item::List SalesforceContactsHandler::itemsFromListEntriesResponse(const TNS__QueryResult &queryResult,
const Akonadi::Collection &parentCollection)
{
Akonadi::Item::List items;
Q_FOREACH (const ENS__SObject &entry, queryResult.records()) {
const QList<KDSoapValue> valueList = entry.any();
if (valueList.isEmpty()) {
kWarning() << "Contacts entry for id=" << entry.id().value() << "has no values";
kDebug() << "fieldsToNull:" << entry.fieldsToNull();
continue;
}
Akonadi::Item item;
item.setRemoteId(entry.id().value());
item.setParentCollection(parentCollection);
item.setMimeType(KABC::Addressee::mimeType());
KABC::Addressee addressee;
addressee.setUid(entry.id().value());
QList<KDSoapValue>::const_iterator it = valueList.constBegin();
QList<KDSoapValue>::const_iterator endIt = valueList.constEnd();
for (; it != endIt; ++it) {
ContactAccessorHash::const_iterator accessorIt = mAccessors->constFind(it->name());
if (accessorIt != mAccessors->constEnd()) {
if (accessorIt->isAvailable) {
accessorIt->setter(it->value().value<QString>(), addressee);
}
} else {
kWarning() << "Contacts entry for id=" << entry.id().value()
<< "has unknown value named" << it->name();
}
}
item.setPayload<KABC::Addressee>(addressee);
items << item;
}
kDebug() << "Query result had" << items.count() << "valid contact items";
return items;
}
示例8: retrieveAddresseeListFromDevice
bool AddressbookHandler::retrieveAddresseeListFromDevice( KABC::Addressee::List &mAddresseeList, QValueList<uint32_t> &idList )
{
KABC::VCardConverter vCardConv;
bool ret = true;
for ( QValueList<uint32_t>::const_iterator it = idList.begin(); it != idList.end(); ++it ) {
incrementSteps();
kdDebug(2120) << "Retrieving Contact from device: " << "RRA-ID-" +
QString::number ( *it, 16 ).rightJustify( 8, '0' ) << endl;
QString vCard = m_rra->getVCard( mTypeId, *it );
if (vCard.isEmpty()) {
addErrorEntry("RRA-ID-" + QString::number ( *it, 16 ).rightJustify( 8, '0' ));
ret = false;
}
KABC::Addressee addr = vCardConv.parseVCard ( vCard );
addr.setFormattedName(addr.formattedName().replace("\\,", ","));
QString kdeId;
if ((kdeId = mUidHelper->kdeId("SynCEAddressbook", addr.uid(), "---")) != "---") {
addr.setUid(kdeId);
} else {
mUidHelper->addId("SynCEAddressbook", addr.uid(), addr.uid());
}
kdDebug(2120) << " ID-Pair: KDEID: " << addr.uid() << " DeviceID: " <<
"RRA-ID-" + QString::number ( *it, 16 ).rightJustify( 8, '0' ) << endl;
mAddresseeList.push_back( addr );
KApplication::kApplication()->processEvents();
}
return ret;
}
示例9: loadAll
bool KDEAccountsFormat::loadAll( KABC::AddressBook *book,
KABC::Resource *resource,
QFile *file )
{
if ( !book || !file ) // eh?
return false;
QString uuid = "KDEAccountsEntry.";
int id = 0;
QByteArray array = file->readAll();
file->close();
QByteArray::ConstIterator it = array.begin();
QByteArray::ConstIterator end = array.end();
QByteArray::ConstIterator startLine;
QString line;
char eol = '\n';
char delim = ' ';
for ( ; it < end; it++ )
{
startLine = it;
for ( ; it && it < end && *it != eol; it++ )
{ } // find eol
uint length = it - startLine;
line = QString::fromUtf8( startLine, length ).simplified();
QString nickName;
QString name;
QString email;
int firstSpace = line.indexOf( delim );
if ( firstSpace > 0 )
{
nickName = line.left( firstSpace );
int lastSpace = line.lastIndexOf( delim );
if ( lastSpace > firstSpace )
{
email = line.mid( lastSpace +1 );
int start = firstSpace + 1;
int length = lastSpace - start;
name = line.mid( start, length );
if ( !email.isEmpty() )
{
KABC::Addressee address;
address.setNickName( nickName );
address.setNameFromString( name );
address.setOrganization("KDE Project");
address.insertCategory("KDE Developer");
address.insertEmail( email );
address.setUid( uuid + QString::number( id++ ));
address.setResource( resource );
book->insertAddressee( address );
}
}
}
}
return true;
}
示例10: fromXml
KABC::Addressee Contact::fromXml(const QString &xml)
{
QDomDocument document;
QString errorMsg;
int errorLine, errorColumn;
if(!document.setContent(xml, true, &errorMsg, &errorLine, &errorColumn))
{
qDebug("Error parsing XML in Scalix::Contact::fromXml: %s (%d,%d)", errorMsg.latin1(), errorLine, errorColumn);
return KABC::Addressee();
}
QDomElement contactElement = document.documentElement();
if(contactElement.tagName() != "contact")
{
if(contactElement.tagName() == "distlist")
{
const QDomNodeList names = contactElement.elementsByTagName("display_name");
const QString listName = (names.count() == 1 ? names.item(0).toElement().text() : "Scalix Dummy List");
/**
* As we can't provide distribution list functionality we store the entry
* here and return it on save.
*/
KPIM::DistributionList list;
list.setName(listName);
if(!s_distListMap)
sd.setObject(s_distListMap, new QMap<QString, QString>());
s_distListMap->insert(list.uid(), xml);
return list;
}
else
{
qDebug("Error interpreting XML in Scalix::Contact::fromXml: no 'contact' or 'distlist' tag found");
return KABC::Addressee();
}
}
QString emails[ 3 ];
KABC::Address homeAddress(KABC::Address::Home);
KABC::Address workAddress(KABC::Address::Work);
KABC::Address otherAddress(KABC::Address::Dom);
KABC::Addressee addr;
setCustom("comes_from_scalix", "true", addr);
QDomNode node = contactElement.firstChild();
while(!node.isNull())
{
QDomElement element = node.toElement();
if(!element.isNull())
{
if(element.tagName() == "direct_ref")
addr.setUid(element.text());
else if(element.tagName() == "sensitivity")
setCustom("sensitivity", element.text(), addr);
else if(element.tagName() == "is_recurring")
setCustom("is_recurring", element.text(), addr);
else if(element.tagName() == "reminder_set")
setCustom("reminder_set", element.text(), addr);
else if(element.tagName() == "send_rich_info")
setCustom("send_rich_info", element.text(), addr);
else if(element.tagName() == "last_modification_time")
addr.setRevision(QDateTime::fromString(element.text(), Qt::ISODate));
// name
else if(element.tagName() == "display_name_prefix")
addr.setPrefix(element.text());
else if(element.tagName() == "first_name")
addr.setGivenName(element.text());
else if(element.tagName() == "middle_name")
addr.setAdditionalName(element.text());
else if(element.tagName() == "last_name")
addr.setFamilyName(element.text());
else if(element.tagName() == "suffix")
addr.setSuffix(element.text());
else if(element.tagName() == "file_as")
addr.setFormattedName(element.text());
else if(element.tagName() == "nickname")
addr.setNickName(element.text());
// job
else if(element.tagName() == "web_page_address")
addr.setUrl(element.text());
else if(element.tagName() == "company_name")
addr.setOrganization(element.text());
else if(element.tagName() == "job_title")
addr.setTitle(element.text());
// emails
else if(element.tagName().startsWith("email"))
{
if(element.tagName() == "email1_address")
emails[ 0 ] = element.text();
else if(element.tagName() == "email2_address")
emails[ 1 ] = element.text();
else if(element.tagName() == "email3_address")
//.........这里部分代码省略.........
示例11: setId
static void setId(const QString &value, KABC::Addressee &addressee)
{
addressee.setUid(value);
}
示例12: msTNEFToVPart
//.........这里部分代码省略.........
if ( bCompatMethodDeclined ) {
attendee->setStatus( Attendee::Tentative );
}
} else {
attendee->setStatus( Attendee::NeedsAction );
attendee->setRole( Attendee::ReqParticipant );
}
event->addAttendee( attendee );
}
}
s = tnefMsg->findProp( 0x3ff8 ); // look for organizer property
if ( s.isEmpty() && !bIsReply ) {
s = sSenderSearchKeyEmail;
}
// TODO: Use the common name?
if ( !s.isEmpty() ) {
event->setOrganizer( s );
}
s = tnefMsg->findProp( 0x819b ).remove( QChar( '-' ) ).remove( QChar( ':' ) );
event->setDtStart( KDateTime::fromString( s ) ); // ## Format??
s = tnefMsg->findProp( 0x819c ).remove( QChar( '-' ) ).remove( QChar( ':' ) );
event->setDtEnd( KDateTime::fromString( s ) );
s = tnefMsg->findProp( 0x810d );
event->setLocation( s );
// is it OK to set this to OPAQUE always ??
//vPart += "TRANSP:OPAQUE\n"; ###FIXME, portme!
//vPart += "SEQUENCE:0\n";
// is "0x0023" OK - or should we look for "0x0003" ??
s = tnefMsg->findProp( 0x0023 );
event->setUid( s );
// PENDING(khz): is this value in local timezone? Must it be
// adjusted? Most likely this is a bug in the server or in
// Outlook - we ignore it for now.
s = tnefMsg->findProp( 0x8202 ).remove( QChar( '-' ) ).remove( QChar( ':' ) );
// ### kcal always uses currentDateTime()
// event->setDtStamp( QDateTime::fromString( s ) );
s = tnefMsg->findNamedProp( "Keywords" );
event->setCategories( s );
s = tnefMsg->findProp( 0x1000 );
event->setDescription( s );
s = tnefMsg->findProp( 0x0070 );
event->setSummary( s );
s = tnefMsg->findProp( 0x0026 );
event->setPriority( s.toInt() );
// is reminder flag set ?
if ( !tnefMsg->findProp( 0x8503 ).isEmpty() ) {
Alarm::Ptr alarm( new Alarm( event.data() ) ); // TODO: fix when KCalCore::Alarm is fixed
KDateTime highNoonTime =
pureISOToLocalQDateTime( tnefMsg->findProp( 0x8502 ).
remove( QChar( '-' ) ).remove( QChar( ':' ) ) );
KDateTime wakeMeUpTime =
pureISOToLocalQDateTime( tnefMsg->findProp( 0x8560, "" ).
remove( QChar( '-' ) ).remove( QChar( ':' ) ) );
alarm->setTime( wakeMeUpTime );
if ( highNoonTime.isValid() && wakeMeUpTime.isValid() ) {
alarm->setStartOffset( Duration( highNoonTime, wakeMeUpTime ) );
示例13: 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;
}