本文整理汇总了C++中kabc::Addressee::uid方法的典型用法代码示例。如果您正苦于以下问题:C++ Addressee::uid方法的具体用法?C++ Addressee::uid怎么用?C++ Addressee::uid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kabc::Addressee
的用法示例。
在下文中一共展示了Addressee::uid方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: openAddressBook
void KOAttendeeEditor::openAddressBook()
{
#ifndef KORG_NOKABC
KPIM::AddressesDialog *dia = new KPIM::AddressesDialog( this, "adddialog" );
dia->setShowCC( false );
dia->setShowBCC( false );
if ( dia->exec() ) {
KABC::Addressee::List aList = dia->allToAddressesNoDuplicates();
for ( KABC::Addressee::List::iterator itr = aList.begin();
itr != aList.end(); ++itr ) {
insertAttendeeFromAddressee( (*itr) );
}
}
delete dia;
return;
#if 0
// old code
KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this);
if (!a.isEmpty()) {
// If this is myself, I don't want to get a response but instead
// assume I will be available
bool myself = KOPrefs::instance()->thatIsMe( a.preferredEmail() );
KCal::Attendee::PartStat partStat =
myself ? KCal::Attendee::Accepted : KCal::Attendee::NeedsAction;
insertAttendee( new Attendee( a.realName(), a.preferredEmail(),
!myself, partStat,
KCal::Attendee::ReqParticipant, a.uid() ) );
}
#endif
#endif
}
示例2: 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;
}
示例3: interpretAddressBookDownloadItemsJob
bool GroupDavGlobals::interpretAddressBookDownloadItemsJob(
KABC::AddressBookAdaptor *adaptor, KIO::Job *job, const QString &jobData)
{
kdDebug(5800) << "GroupDavGlobals::interpretAddressBookDownloadItemsJob, vCard=" << endl;
kdDebug(5800) << jobData << endl;
if(!adaptor || !job) return false;
KABC::VCardConverter conv;
KABC::Addressee::List addrs(conv.parseVCards(jobData));
if(addrs.count() != 1)
{
kdError() << "Parsed vCard does not contain exactly one addressee." << endl;
return false;
}
KABC::Addressee a = addrs.first();
KIO::SimpleJob *sjob = dynamic_cast<KIO::SimpleJob *>(job);
KURL remoteId;
if(sjob) remoteId = sjob->url();
QString fingerprint = extractFingerprint(job, jobData);
adaptor->addressbookItemDownloaded(a, a.uid(), remoteId, fingerprint,
remoteId.prettyURL());
return true;
}
示例4: getAvatar
QString ContactsModel::getAvatar(KABC::Addressee contact) const
{
KABC::Picture pic = contact.photo();
qDebug() << "Picture url: " << pic.url();
if (pic.isIntern()) {
QString url = "contacts/"+contact.uid();
ImageProvider::getInstance()->registerImage(url, pic.data());
return "image://images/"+url;
} else
return pic.url();
}
示例5: 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;
}
示例6: 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;
}
示例7: setAddressee
void AddresseeEditorWidget::setAddressee( const KABC::Addressee &addr )
{
if ( mAddressee.uid() == addr.uid() )
return;
mAddressee = addr;
bool readOnly = false;
if ( KABC::Resource *res = addr.resource() ) {
if ( res->readOnly() ) {
readOnly = true;
//Kolab resources have finer access control than planned in the overall design.
} else if ( res->inherits( "KPIM::ResourceABC" ) ) {
KPIM::ResourceABC *resAbc = static_cast<KPIM::ResourceABC *>( res );
QString subresource = resAbc->uidToResourceMap()[ addr.uid() ];
if ( !subresource.isEmpty() )
readOnly |= !resAbc->subresourceWritable( subresource );
}
}
setReadOnly( readOnly );
load();
}
示例8: 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;
}
}
示例9: insertAttendeeFromAddressee
void KOAttendeeEditor::insertAttendeeFromAddressee(const KABC::Addressee &a, const Attendee * at)
{
bool myself = KOPrefs::instance()->thatIsMe( a.preferredEmail() );
bool sameAsOrganizer = mOrganizerCombo &&
KPIM::compareEmail( a.preferredEmail(), mOrganizerCombo->currentText(), false );
KCal::Attendee::PartStat partStat = at? at->status() : KCal::Attendee::NeedsAction;
bool rsvp = at? at->RSVP() : true;
if ( myself && sameAsOrganizer ) {
partStat = KCal::Attendee::Accepted;
rsvp = false;
}
Attendee *newAt = new Attendee( a.realName(),
a.preferredEmail(),
!myself, partStat,
at ? at->role() : Attendee::ReqParticipant,
a.uid() );
newAt->setRSVP( rsvp );
insertAttendee( newAt, true );
}
示例10: 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();
}
//.........这里部分代码省略.........
示例11: 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);
//.........这里部分代码省略.........
示例12: doCommand
/**
* Perform an addressbook command (edit contact, create new contact,
* change/delete association.)
* @param id The command id. @ref CommandIDs.
*
* The operation is performed on the nickname at the currently-selected item in
* the nicklistview.
*
* Also refreshes the nicklistview display to reflect the new addressbook state
* for the nick.
*/
void NicksOnline::doCommand(int id)
{
if(id < 0)
{
return;
}
QString serverName;
QString nickname;
QListViewItem* item = m_nickListView->selectedItem();
if(!getItemServerAndNick(item, serverName, nickname))
{
return;
}
// Get the server object corresponding to the server name.
Server* server = KonversationApplication::instance()->getConnectionManager()->getServerByName(serverName);
if (!server) return;
// Get NickInfo object corresponding to the nickname.
NickInfoPtr nickInfo = server->getNickInfo(nickname);
// Get addressbook entry for the nick.
KABC::Addressee addressee;
if(nickInfo)
{
addressee = nickInfo->getAddressee();
}
else
{
addressee = server->getOfflineNickAddressee(nickname);
}
switch(id)
{
case ciSendEmail:
Konversation::Addressbook::self()->sendEmail(addressee);
return; //no need to refresh item
case ciAddressbookEdit:
Konversation::Addressbook::self()->editAddressee(addressee.uid());
return; //no need to refresh item - nickinfo changed will be called anyway.
case ciAddressbookChange:
if(nickInfo)
{
nickInfo->showLinkAddressbookUI();
}
else
{
LinkAddressbookUI *linkaddressbookui = new LinkAddressbookUI(server->getViewContainer()->getWindow(), NULL, nickname, server->getServerName(), server->getDisplayName(), addressee.realName());
linkaddressbookui->show();
}
break;
case ciAddressbookNew:
case ciAddressbookDelete:
{
Konversation::Addressbook *addressbook = Konversation::Addressbook::self();
if(addressbook && addressbook->getAndCheckTicket())
{
if(id == ciAddressbookDelete)
{
if (addressee.isEmpty())
{
return;
}
addressbook->unassociateNick(addressee, nickname, server->getServerName(), server->getDisplayName());
}
else
{
addressee.setGivenName(nickname);
addressee.setNickName(nickname);
addressbook->associateNickAndUnassociateFromEveryoneElse(addressee, nickname, server->getServerName(), server->getDisplayName());
}
if(addressbook->saveTicket())
{
//saveTicket will refresh the addressees for us.
if(id == ciAddressbookNew)
{
Konversation::Addressbook::self()->editAddressee(addressee.uid());
}
}
}
break;
}
case ciJoinChannel:
{
//.........这里部分代码省略.........
示例13: getId
static QString getId(const KABC::Addressee &addressee)
{
return addressee.uid();
}