本文整理汇总了C++中kabc::Addressee::preferredEmail方法的典型用法代码示例。如果您正苦于以下问题:C++ Addressee::preferredEmail方法的具体用法?C++ Addressee::preferredEmail怎么用?C++ Addressee::preferredEmail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kabc::Addressee
的用法示例。
在下文中一共展示了Addressee::preferredEmail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: selectedEmails
QString KAddressBookView::selectedEmails()
{
bool first = true;
QString emailAddrs;
const QStringList uidList = selectedUids();
KABC::Addressee addr;
QString email;
QStringList::ConstIterator it;
for(it = uidList.begin(); it != uidList.end(); ++it)
{
addr = mCore->addressBook()->findByUid(*it);
if(!addr.isEmpty())
{
QString m = QString::null;
if(addr.emails().count() > 1)
m = KABC::EmailSelector::getEmail(addr.emails(), addr.preferredEmail(), this);
email = addr.fullEmail(m);
if(!first)
emailAddrs += ", ";
else
first = false;
emailAddrs += email;
}
}
return emailAddrs;
}
示例3: addVCard
bool KAddrBookExternal::addVCard(const KABC::Addressee &addressee, QWidget *parent)
{
KABC::AddressBook *ab = KABC::StdAddressBook::self(true);
bool inserted = false;
ab->setErrorHandler(new KABC::GuiErrorHandler(parent));
KABC::Addressee::List addressees =
ab->findByEmail(addressee.preferredEmail());
if(addressees.isEmpty())
{
if(KAddrBookExternal::addAddressee(addressee))
{
QString text = i18n("The VCard was added to your addressbook; "
"you can add more information to this "
"entry by opening the addressbook.");
KMessageBox::information(parent, text, QString::null, "addedtokabc");
inserted = true;
}
}
else
{
QString text = i18n("The VCard's primary email address is already in "
"your addressbook; however, you may save the VCard "
"into a file and import it into the addressbook "
"manually.");
KMessageBox::information(parent, text);
inserted = true;
}
ab->setErrorHandler(0);
return inserted;
}
示例4: insertAttendeeFromAddressee
void KOAttendeeEditor::insertAttendeeFromAddressee( const KABC::Addressee &a, const Attendee *at )
{
bool myself = KOPrefs::instance()->thatIsMe( a.preferredEmail() );
bool sameAsOrganizer = mOrganizerCombo &&
KPIMUtils::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 );
}
示例5: addresseeToUserId
static QString addresseeToUserId( const KABC::Addressee& addr, IMAPUserIdFormat userIdFormat )
{
QString email = addr.preferredEmail();
if ( userIdFormat == FullEmail )
return email;
else { // mUserIdFormat == UserName
email.truncate( email.indexOf( '@' ) );
return email;
}
}
示例6: QString
static QString getEmail2(const KABC::Addressee &addressee)
{
// preferred might not be the first one, so remove it and take the first of
// the remaining instead of always taking the second one
QStringList emails = addressee.emails();
emails.removeAll(addressee.preferredEmail());
if (emails.count() >= 1) {
return emails[ 0 ];
}
return QString();
}
示例7: onItemsFetched
void akonadimailsearch::onItemsFetched(KJob *job)
{
if (job->error()) {
kWarning() << job->errorString();
} else {
ItemFetchJob *itemFetchJob = qobject_cast<ItemFetchJob*>(job);
foreach (const Item &item, itemFetchJob->items()) {
if(item.hasPayload<KABC::Addressee>()) {
const QString id = item.url().prettyUrl();
const KABC::Addressee contact = item.payload<KABC::Addressee>();
QTextStream out(stdout);
if(contact.preferredEmail().size() > 0 && \
( contact.preferredEmail().contains(mysearch) || contact.formattedName().contains(mysearch) )){
out << contact.formattedName() << " <" << contact.preferredEmail()<< ">" <<endl;
}
}
}
}
if (--activeFetchJobsCount == 0) {
emit finished();
}
}
示例8: parseMembersAttribute
void KCalResourceSlox::parseMembersAttribute( const QDomElement &e,
Incidence *incidence )
{
incidence->clearAttendees();
QDomNode n;
for( n = e.firstChild(); !n.isNull(); n = n.nextSibling() ) {
QDomElement memberElement = n.toElement();
if ( memberElement.tagName() == fieldName( Participant ) ) {
QString member = memberElement.text();
KABC::Addressee account;
if ( mAccounts ) account = mAccounts->lookupUser( member );
else kError() << "KCalResourceSlox: no accounts set";
QString name;
QString email;
Attendee *a = incidence->attendeeByUid( member );
if ( account.isEmpty() ) {
if ( a ) continue;
name = member;
email = member + '@' + KUrl( mPrefs->url() ).host();
} else {
name = account.realName();
email = account.preferredEmail();
}
if ( a ) {
a->setName( name );
a->setEmail( email );
} else {
a = new Attendee( name, email );
a->setUid( member );
incidence->addAttendee( a );
}
QString status = memberElement.attribute( "confirm" );
if ( !status.isEmpty() ) {
if ( status == "accept" ) {
a->setStatus( Attendee::Accepted );
} else if ( status == "decline" ) {
a->setStatus( Attendee::Declined );
} else {
a->setStatus( Attendee::NeedsAction );
}
}
} else {
kDebug() << "Unknown tag in members attribute:"
<< memberElement.tagName();
}
}
}
示例9: contactToTemplate
void ReportGenerator::contactToTemplate( TextTemplate *tmpl, const QString& prefix, const KABC::Addressee& contact )
{
if( contact.isEmpty() ) return;
tmpl->setValue( ADDRESS_TAG( prefix, "NAME" ), escapeTrml2pdfXML( contact.realName() ) );
QString co = contact.organization();
if( co.isEmpty() ) {
co = contact.realName();
}
tmpl->setValue( ADDRESS_TAG( prefix, "ORGANISATION" ), escapeTrml2pdfXML( co ) );
tmpl->setValue( ADDRESS_TAG( prefix, "URL" ), escapeTrml2pdfXML( contact.url().prettyUrl() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "EMAIL" ), escapeTrml2pdfXML( contact.preferredEmail() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "PHONE" ), escapeTrml2pdfXML( contact.phoneNumber( KABC::PhoneNumber::Work ).number() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "FAX" ), escapeTrml2pdfXML( contact.phoneNumber( KABC::PhoneNumber::Fax ).number() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "CELL" ), escapeTrml2pdfXML( contact.phoneNumber( KABC::PhoneNumber::Cell ).number() ) );
KABC::Address address;
address = contact.address( KABC::Address::Pref );
if( address.isEmpty() )
address = contact.address(KABC::Address::Work );
if( address.isEmpty() )
address = contact.address(KABC::Address::Home );
if( address.isEmpty() )
address = contact.address(KABC::Address::Postal );
tmpl->setValue( ADDRESS_TAG( prefix, "POSTBOX" ),
escapeTrml2pdfXML( address.postOfficeBox() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "EXTENDED" ),
escapeTrml2pdfXML( address.extended() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "STREET" ),
escapeTrml2pdfXML( address.street() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "LOCALITY" ),
escapeTrml2pdfXML( address.locality() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "REGION" ),
escapeTrml2pdfXML( address.region() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "POSTCODE" ),
escapeTrml2pdfXML( address.postalCode() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "COUNTRY" ),
escapeTrml2pdfXML( address.country() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "REGION" ),
escapeTrml2pdfXML( address.region() ) );
tmpl->setValue( ADDRESS_TAG( prefix,"LABEL" ),
escapeTrml2pdfXML( address.label() ) );
}
示例10: icon
AddresseeItem::AddresseeItem( QTreeWidget *parent, const KABC::Addressee &addressee) :
QTreeWidgetItem( parent ),
mAddressee( addressee )
{
//We can't save showphoto because we don't have a d pointer
KABC::Picture pic = mAddressee.photo();
if(!pic.isIntern())
pic = mAddressee.logo();
if(pic.isIntern())
{
//60 pixels seems okay.. kmail uses 60 btw
QIcon icon( QPixmap::fromImage( pic.data().scaledToWidth(60) ) );
setIcon( Photo, icon );
}
setText( Name, addressee.realName() );
setText( Email, addressee.preferredEmail() );
}
示例11: parseIncidenceAttribute
void KCalResourceSlox::parseIncidenceAttribute( const QDomElement &e,
Incidence *incidence )
{
QString tag = e.tagName();
QString text = decodeText( e.text() );
if ( text.isEmpty() ) return;
if ( tag == fieldName( IncidenceTitle ) ) {
incidence->setSummary( text );
} else if ( e.tagName() == fieldName( Description ) ) {
incidence->setDescription( text );
} else if ( tag == fieldName( Reminder ) ) {
int minutes = text.toInt();
if ( minutes != 0 ) {
Alarm::List alarms = incidence->alarms();
Alarm *alarm;
if ( alarms.isEmpty() ) alarm = incidence->newAlarm();
else alarm = alarms.first();
if ( alarm->type() == Alarm::Invalid ) {
alarm->setType( Alarm::Display );
}
Duration d( minutes * -60 );
alarm->setStartOffset( d );
alarm->setEnabled( true );
} else {
// 0 reminder -> disable alarm
incidence->clearAlarms();
}
} else if ( tag == fieldName( CreatedBy ) ) {
KABC::Addressee a;
if ( mAccounts ) a = mAccounts->lookupUser( text );
else kDebug() << "KCalResourceSlox: no accounts set";
incidence->setOrganizer( Person( a.formattedName(), a.preferredEmail() ) );
} else if ( tag == fieldName( Participants ) ) {
parseMembersAttribute( e, incidence );
} else if ( tag == "readrights" ) {
parseReadRightsAttribute( e, incidence );
} else if ( tag == fieldName( Categories ) ) {
incidence->setCategories( text.split( QRegExp(",\\s*") ) );
} else if ( tag == fieldName( LastModified ) && type() == "ox" ) {
incidence->setCustomProperty( "SLOX", "LastModified", text );
}
}
示例12: allAddressee
KABC::Addressee::List
AddressesDialog::allToAddressesNoDuplicates() const
{
KABC::Addressee::List aList = allAddressee( d->toItem );
const QStringList dList = toDistributionLists();
KABC::AddressBook* abook = KABC::StdAddressBook::self( true );
for ( QStringList::ConstIterator it = dList.constBegin(); it != dList.constEnd(); ++it ) {
const KABC::DistributionList *list = abook->findDistributionListByName( *it );
if ( !list )
continue;
const KABC::DistributionList::Entry::List eList = list->entries();
KABC::DistributionList::Entry::List::ConstIterator eit;
for( eit = eList.constBegin(); eit != eList.constEnd(); ++eit ) {
KABC::Addressee a = (*eit).addressee();
if ( !a.preferredEmail().isEmpty() && !aList.contains( a ) ) {
aList.append( a ) ;
}
}
}
return aList;
}
示例13: openAddressbook
void PublishDialog::openAddressbook()
{
#ifndef KORG_NOKABC
KABC::Addressee::List addressList;
addressList = KABC::AddresseeDialog::getAddressees( this );
//KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this);
KABC::Addressee a = addressList.first();
if ( !a.isEmpty() ) {
uint i;
for ( i=0; i<addressList.size(); i++ ) {
a = addressList[i];
mWidget->mNameLineEdit->setEnabled( true );
mWidget->mEmailLineEdit->setEnabled( true );
QListViewItem *item = new QListViewItem( mWidget->mAddressListView );
mWidget->mAddressListView->setSelected( item, true );
mWidget->mNameLineEdit->setText( a.realName() );
mWidget->mEmailLineEdit->setText( a.preferredEmail() );
mWidget->mAddressListView->insertItem( item );
}
}
#endif
}
示例14: openAddressbook
void PublishDialog::openAddressbook()
{
KABC::Addressee::List addressList = KABC::AddresseeDialog::getAddressees( this );
if( addressList.isEmpty() ) {
return;
}
KABC::Addressee a = addressList.first();
if ( !a.isEmpty() ) {
int i;
for ( i=0; i<addressList.size(); i++ ) {
a = addressList[i];
mUI.mNameLineEdit->setEnabled( true );
mUI.mEmailLineEdit->setEnabled( true );
QListWidgetItem *item = new QListWidgetItem( mUI.mListWidget );
mUI.mListWidget->setItemSelected( item, true );
mUI.mNameLineEdit->setText( a.realName() );
mUI.mEmailLineEdit->setText( a.preferredEmail() );
mUI.mListWidget->addItem( item );
}
mUI.mRemove->setEnabled( true );
}
}
示例15: expandMacros
bool TemplateInterface::expandMacros( QMap<QString, QString> &map, QWidget *parentWindow )
{
KABC::StdAddressBook *addrBook = 0;
KABC::Addressee userAddress;
QDateTime datetime = QDateTime::currentDateTime();
QDate date = datetime.date();
QTime time = datetime.time();
QMap<QString,QString>::Iterator it;
for ( it = map.begin(); it != map.end(); ++it )
{
QString placeholder = it.key();
if ( map[ placeholder ].isEmpty() )
{
if ( placeholder == "index" ) map[ placeholder ] = "i";
else if ( placeholder == "loginname" )
{}
else if ( placeholder == "firstname" )
{
INITKABC;
if ( !userAddress.isEmpty() )
map[ placeholder ] = userAddress.givenName();
}
else if ( placeholder == "lastname" )
{
INITKABC;
if ( !userAddress.isEmpty() )
map[ placeholder ] = userAddress.familyName();
}
else if ( placeholder == "fullname" )
{
INITKABC;
if ( !userAddress.isEmpty() )
map[ placeholder ] = userAddress.assembledName();
}
else if ( placeholder == "email" )
{
INITKABC;
if ( !userAddress.isEmpty() )
map[ placeholder ] = userAddress.preferredEmail();
}
else if ( placeholder == "date" )
{
map[ placeholder ] = KGlobal::locale() ->formatDate( date, true );
}
else if ( placeholder == "time" )
{
map[ placeholder ] = KGlobal::locale() ->formatTime( time, true, false );
}
else if ( placeholder == "year" )
{
map[ placeholder ] = KGlobal::locale() ->calendar() ->yearString( date, false );
}
else if ( placeholder == "month" )
{
map[ placeholder ] = QString::number( KGlobal::locale() ->calendar() ->month( date ) );
}
else if ( placeholder == "day" )
{
map[ placeholder ] = QString::number( KGlobal::locale() ->calendar() ->day( date ) );
}
else if ( placeholder == "hostname" )
{
char hostname[ 256 ];
hostname[ 0 ] = 0;
gethostname( hostname, 255 );
hostname[ 255 ] = 0;
map[ placeholder ] = QString::fromLocal8Bit( hostname );
}
else if ( placeholder == "cursor" )
{
map[ placeholder ] = "|";
}
else map[ placeholder ] = placeholder;
}
}
return true;
}