本文整理汇总了C++中kabc::Addressee::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ Addressee::isEmpty方法的具体用法?C++ Addressee::isEmpty怎么用?C++ Addressee::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kabc::Addressee
的用法示例。
在下文中一共展示了Addressee::isEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testNewList
void TestDistrList::testNewList()
{
kDebug() ;
DistributionList dl;
dl.setName( "foo" );
assert( !dl.isEmpty() );
check( "name set", dl.formattedName(), "foo" );
assert( DistributionList::isDistributionList( dl ) );
KABC::AddressBook *ab = KABC::StdAddressBook::self();
ab->insertAddressee( dl );
#if 0 // can't do that until we have KABC::AddressBook::findByFormattedName, or we use setName()
KABC::Addressee::List addrList = ab->findByName( "foo" );
assert( addrList.count() == 1 );
KABC::Addressee addr = addrList.first();
assert( !addr.isEmpty() );
check( "correct name", addr.name(), "foo" );
assert( DistributionList::isDistributionList( addr ) );
#else
KABC::Addressee addr = dl;
#endif
DistributionList dl2 = DistributionList::findByName( ab, "foo" );
assert( !dl2.isEmpty() );
check( "correct name", dl2.formattedName(), "foo" );
assert( DistributionList::isDistributionList( dl2 ) );
// Test the ctor that takes an addressee
DistributionList dl3( addr );
assert( !dl3.isEmpty() );
assert( DistributionList::isDistributionList( dl3 ) );
check( "correct name", dl3.formattedName(), "foo" );
}
示例2: formatAttendees
void HtmlExport::formatAttendees( QTextStream *ts, Incidence *event )
{
Attendee::List attendees = event->attendees();
if (attendees.count()) {
*ts << "<em>";
#ifndef KORG_NOKABC
KABC::AddressBook *add_book = KABC::StdAddressBook::self( true );
KABC::Addressee::List addressList;
addressList = add_book->findByEmail(event->organizer().email());
KABC::Addressee o = addressList.first();
if (!o.isEmpty() && addressList.size()<2) {
*ts << "<a href=\"mailto:" << event->organizer().email() << "\">";
*ts << cleanChars(o.formattedName()) << "</a>\n";
}
else *ts << event->organizer().fullName();
#else
*ts << event->organizer().fullName();
#endif
*ts << "</em><br />";
Attendee::List::ConstIterator it;
for( it = attendees.begin(); it != attendees.end(); ++it ) {
Attendee *a = *it;
if (!a->email().isEmpty()) {
*ts << "<a href=\"mailto:" << a->email();
*ts << "\">" << cleanChars(a->name()) << "</a>";
}
else {
*ts << " " << cleanChars(a->name());
}
*ts << "<br />" << "\n";
}
} else {
*ts << " \n";
}
}
示例3: 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;
}
示例4: 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;
}
示例5: 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
}
示例6: sendFile
/**
* Send the file to the contact
* @param uid the KABC uid you are sending to.
* @param sourceURL a KURL to send.
* @param altFileName an alternate filename describing the file
* @param fileSize file size in bytes
*/
void Addressbook::sendFile(const QString &uid, const KURL &sourceURL, const QString &altFileName, uint fileSize)
{
if(uid.isEmpty())
{
focusAndShowErrorMessage(i18n("Another KDE application tried to use Konversation to send a file to a contact, but did not specify any contact to send the file to. This is probably a bug in the other application."));
return;
}
KABC::Addressee addressee = addressBook->findByUid(uid);
if(addressee.isEmpty())
{
focusAndShowErrorMessage(i18n("Another KDE application tried to use Konversation to send a file to a contact, but Konversation could not find the specified contact in the KDE address book."));
return;
}
NickInfoPtr nickInfo = getNickInfo(addressee);
if(!nickInfo)
{
QString user = addressee.fullEmail();
if(!user.isEmpty()) user = " (" + user + ')';
focusAndShowErrorMessage(i18n("Another KDE application tried to use Konversation to send a file to a contact, but the requested user%1 is not currently online.").arg(user));
return;
}
nickInfo->getServer()->addDccSend(nickInfo->getNickname(), sourceURL, altFileName, fileSize);
QWidget *widget = nickInfo->getServer()->getViewContainer()->getWindow();
KWin::demandAttention(widget->winId()); //If activeWindow request is denied, at least demand attention!
KWin::activateWindow(widget->winId()); //May or may not work, depending on focus stealing prevention.
}
示例7: widgetModified
void AddresseeEditorDialog::widgetModified()
{
const KABC::Addressee addressee = mEditorWidget->addressee();
if ( !addressee.isEmpty() )
setTitle( addressee );
enableButton( KDialogBase::Apply, true );
}
示例8: slotAddresseeFound
void DocumentModel::slotAddresseeFound( const QString& uid, const KABC::Addressee & addressee )
{
if( addressee.isEmpty() ) {
kDebug() << "No address found for uid " << uid;
mAddresses[uid] = KABC::Addressee();
} else {
mAddresses[uid] = addressee;
}
}
示例9: slotAddresseeFound
void KraftView::slotAddresseeFound( const QString& uid, const KABC::Addressee& contact )
{
if( !contact.isEmpty() ) {
kDebug() << "Addressee Found with uid " << uid;
slotNewAddress( contact, false );
kDebug() << "The loaded Contact has this realname: " << contact.realName() << endl;
} else {
kDebug() << "No contact found for uid " << uid;
}
}
示例10: contacts
KABC::AddresseeList XXPortSelectDialog::contacts()
{
const QStringList selection = mCore->selectedUIDs();
KABC::AddresseeList list;
if ( mUseSelection->isChecked() ) {
QStringList::ConstIterator it;
for ( it = selection.constBegin(); it != selection.constEnd(); ++it ) {
KABC::Addressee addr = mCore->addressBook()->findByUid( *it );
if ( !addr.isEmpty() )
list.append( addr );
}
} else if ( mUseFilters->isChecked() ) {
// find contacts that can pass selected filter
Filter::List::ConstIterator filterIt;
for ( filterIt = mFilters.constBegin(); filterIt != mFilters.constEnd(); ++filterIt )
if ( (*filterIt).name() == mFiltersCombo->currentText() )
break;
KABC::AddressBook::Iterator it;
for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) {
if ( (*filterIt).filterAddressee( *it ) )
list.append( *it );
}
} else if ( mUseCategories->isChecked() ) {
const QStringList categorieList = categories();
KABC::AddressBook::ConstIterator it;
KABC::AddressBook::ConstIterator addressBookEnd( mCore->addressBook()->constEnd() );
for ( it = mCore->addressBook()->constBegin(); it != addressBookEnd; ++it ) {
const QStringList tmp( (*it).categories() );
QStringList::ConstIterator tmpIt;
for ( tmpIt = tmp.constBegin(); tmpIt != tmp.constEnd(); ++tmpIt )
if ( categorieList.contains( *tmpIt ) ) {
list.append( *it );
break;
}
}
} else {
// create a string list of all entries:
KABC::AddressBook::ConstIterator it;
for ( it = mCore->addressBook()->constBegin(); it != mCore->addressBook()->constEnd(); ++it )
list.append( *it );
}
if ( mUseSorting ) {
list.setReverseSorting( mSortTypeCombo->currentIndex() == 1 );
int pos = mFieldCombo->currentIndex();
if ( pos < mFields.count() )
list.sortByField( mFields[ pos ] );
}
return list;
}
示例11: slotLoadFromKABC
void KoDocumentInfoDlg::slotLoadFromKABC()
{
#ifdef KDEPIMLIBS_FOUND
KABC::StdAddressBook *ab = static_cast<KABC::StdAddressBook*>
(KABC::StdAddressBook::self());
if (!ab)
return;
KABC::Addressee addr = ab->whoAmI();
if (addr.isEmpty()) {
KMessageBox::sorry(0, i18n("No personal contact data set, please use the option \
\"Set as Personal Contact Data\" from the \"Edit\" menu in KAddressbook to set one."));
return;
}
示例12: 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;
}
示例13: 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();
}
}
}
示例14: selectedUids
KABC::Addressee::List ViewManager::selectedAddressees() const
{
KABC::Addressee::List list;
const QStringList uids = selectedUids();
QStringList::ConstIterator it;
for(it = uids.begin(); it != uids.end(); ++it)
{
KABC::Addressee addr = mCore->addressBook()->findByUid(*it);
if(!addr.isEmpty())
list.append(addr);
}
return list;
}
示例15: 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() ) );
}