本文整理汇总了C++中kabc::addressee::List::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ List::begin方法的具体用法?C++ List::begin怎么用?C++ List::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kabc::addressee::List
的用法示例。
在下文中一共展示了List::begin方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addAddressees
bool AddressbookHandler::addAddressees( KABC::Addressee::List& p_addresseeList )
{
bool ret = true;
KABC::VCardConverter vCardConv;
QString vCard;
RRA_Uint32Vector* added_ids = rra_uint32vector_new();
if ( p_addresseeList.begin() == p_addresseeList.end() ) {
goto finish;
}
for (KABC::Addressee::List::Iterator it = p_addresseeList.begin();
it != p_addresseeList.end(); ++it ) {
incrementSteps();
kdDebug(2120) << "Adding Contact on Device: " << (*it).uid() << endl;
vCard = vCardConv.createVCard ( ( *it ) );
uint32_t newObjectId = m_rra->putVCard( vCard, mTypeId, 0 );
if (newObjectId == 0) {
addErrorEntry((*it).realName());
ret = false;
}
m_rra->markIdUnchanged( mTypeId, newObjectId );
mUidHelper->addId("SynCEAddressbook",
"RRA-ID-" + QString::number ( newObjectId, 16 ).rightJustify( 8, '0' ),
(*it).uid());
kdDebug(2120) << " ID-Pair: KDEID: " << (*it).uid() << " DeviceID: " <<
"RRA-ID-" + QString::number ( newObjectId, 16 ).rightJustify( 8, '0' ) << endl;
rra_uint32vector_add(added_ids, newObjectId);
KApplication::kApplication()->processEvents();
}
finish:
m_rra->registerAddedObjects(mTypeId, added_ids);
rra_uint32vector_destroy(added_ids, true);
return ret;
}
示例2: insertIntoAddressBookSyncee
void AddressbookHandler::insertIntoAddressBookSyncee(KSync::AddressBookSyncee *mAddressBookSyncee, KABC::Addressee::List &list, int state)
{
for(KABC::Addressee::List::Iterator it = list.begin(); it != list.end(); ++it) {
KSync::AddressBookSyncEntry entry(*it, mAddressBookSyncee);
entry.setState(state);
mAddressBookSyncee->addEntry(entry.clone());
}
}
示例3: addresseesToEmails
QString AddresseeUtil::addresseesToEmails(const KABC::Addressee::List &addrList)
{
QStringList emails;
KABC::Addressee::List::ConstIterator it;
for(it = addrList.begin(); it != addrList.end(); ++it)
emails.append((*it).fullEmail());
return emails.join(",");
}
示例4: removeAddressees
bool AddressbookHandler::removeAddressees ( KABC::Addressee::List& p_addresseeList )
{
// int errorCount = 0;
bool ret = false;
RRA_Uint32Vector* deleted_ids = rra_uint32vector_new();
KABC::Addressee::List::Iterator it = p_addresseeList.begin();
if ( p_addresseeList.begin() == p_addresseeList.end() ) {
goto success;
}
setStatus("Erasing deleted Contacts");
for ( ; it != p_addresseeList.end(); ++it ) {
incrementSteps();
QString kUid = mUidHelper->konnectorId("SynCEAddressbook", (*it).uid(), "---");
if (kUid != "---") {
kdDebug(2120) << "Removing Contact on Device: " << "ID-Pair: KDEID: " <<
(*it).uid() << " DeviceId: " << kUid << endl;
if (!m_rra->deleteObject (mTypeId, getOriginalId( kUid ))) {
// if (errorCount++ == -1) {
// goto error;
// }
}
mUidHelper->removeId("SynCEAddressbook", kUid);
rra_uint32vector_add(deleted_ids, getOriginalId( kUid ));
}
KApplication::kApplication()->processEvents();
}
success:
ret = true;
// error:
m_rra->removeDeletedObjects(mTypeId, deleted_ids);
rra_uint32vector_destroy(deleted_ids, true);
return ret;
}
示例5: updateAddressees
bool AddressbookHandler::updateAddressees( KABC::Addressee::List& p_addresseeList )
{
bool ret = true;
KABC::Addressee::List::Iterator it = p_addresseeList.begin();
KABC::VCardConverter vCardConv;
QString vCard;
if ( p_addresseeList.begin() == p_addresseeList.end() ) {
goto finish;
}
setStatus("Writing changed Contacts");
for ( ; it != p_addresseeList.end(); ++it ) {
incrementSteps();
QString kUid = mUidHelper->konnectorId("SynCEAddressbook", (*it).uid(), "---");
if (kUid != "---") {
kdDebug(2120) << "Updating Contact on Device: " << "ID-Pair: KDEID: " <<
(*it).uid() << " DeviceId: " << kUid << endl;
vCard = vCardConv.createVCard ( ( *it ) );
uint32_t retId = m_rra->putVCard ( vCard, mTypeId, getOriginalId( kUid ) );
if (retId == 0) {
addErrorEntry((*it).realName());
ret = false;
}
m_rra->markIdUnchanged( mTypeId, getOriginalId( kUid ) );
}
KApplication::kApplication()->processEvents();
}
finish:
return ret;
}
示例6: openAddressBook
void KOAttendeeEditor::openAddressBook()
{
QPointer<KPIM::AddressesDialog> dia = new KPIM::AddressesDialog( this );
dia->setShowCC( false );
dia->setShowBCC( false );
if ( dia->exec() == QDialog::Accepted ) {
KABC::Addressee::List aList = dia->allToAddressesNoDuplicates();
for ( KABC::Addressee::List::iterator itr = aList.begin();
itr != aList.end(); ++itr ) {
insertAttendeeFromAddressee( (*itr) );
}
}
delete dia;
return;
}
示例7: dropped
void ViewManager::dropped(QDropEvent *e)
{
kdDebug(5720) << "ViewManager::dropped: got a drop event" << endl;
// don't allow drops from our own drags
if(e->source() == this)
return;
QString clipText, vcards;
KURL::List urls;
if(KURLDrag::decode(e, urls))
{
KURL::List::ConstIterator it = urls.begin();
int c = urls.count();
if(c > 1)
{
QString questionString = i18n("Import one contact into your addressbook?", "Import %n contacts into your addressbook?", c);
if(KMessageBox::questionYesNo(this, questionString, i18n("Import Contacts?"), i18n("Import"), i18n("Do Not Import")) == KMessageBox::Yes)
{
for(; it != urls.end(); ++it)
emit urlDropped(*it);
}
}
else if(c == 1)
emit urlDropped(*it);
}
else if(KVCardDrag::decode(e, vcards))
{
KABC::VCardConverter converter;
const KABC::Addressee::List list = converter.parseVCards(vcards);
KABC::Addressee::List::ConstIterator it;
for(it = list.begin(); it != list.end(); ++it)
{
KABC::Addressee a = mCore->addressBook()->findByUid((*it).uid());
if(a.isEmpty()) // not yet in address book
{
mCore->addressBook()->insertAddressee(*it);
emit modified();
}
}
mActiveView->refresh();
}
}
示例8: contactsEnd
KABC::Addressee::List KAddressBookView::addressees()
{
if(mFilter.isEmpty())
return mCore->searchManager()->contacts();
KABC::Addressee::List addresseeList;
const KABC::Addressee::List contacts = mCore->searchManager()->contacts();
KABC::Addressee::List::ConstIterator it;
KABC::Addressee::List::ConstIterator contactsEnd(contacts.end());
for(it = contacts.begin(); it != contactsEnd; ++it)
{
if(mFilter.filterAddressee(*it))
addresseeList.append(*it);
}
return addresseeList;
}
示例9: categories
QStringList KabcBridge::categories()
{
KABC::AddressBook *addressBook = KABC::StdAddressBook::self( true );
KABC::Addressee::List addresses = addressBook->allAddressees();
QStringList allcategories, aux;
for ( KABC::Addressee::List::Iterator it = addresses.begin();
it != addresses.end(); ++it ) {
aux = ( *it ).categories();
for ( QStringList::ConstIterator itAux = aux.constBegin();
itAux != aux.constEnd(); ++itAux ) {
// don't have duplicates in allcategories
if ( !allcategories.contains( *itAux ) )
allcategories += *itAux;
}
}
return allcategories;
}
示例10: attach
void FritzBoxPhoneBook::attach(const KABC::Addressee::List contacts)
{
KABC::Addressee::List::const_iterator contactI = contacts.begin();
for ( ; contactI != contacts.end(); contactI++) {
// kDebug() << "Now are "
// << m_Contacts.size()
// << " Contacts in List ";
// If a Name has 3 work numbers or 5 Phones it is necessary to generate
// 2 or more entrys of the same name eg "Björn Lässig (2)"
int count = 1; // counts the necessary doubled Names
FritzBoxPhoneBookContact fbContact(contactI->formattedName().simplified());
KABC::PhoneNumber::List phoneNumbers = contactI->phoneNumbers();
KABC::PhoneNumber::List::const_iterator phoneNumber = phoneNumbers.begin();
for (; phoneNumber != phoneNumbers.end(); phoneNumber++) {
FritzBoxPhoneNumber fbNumber(phoneNumber->number().simplified());
if ( phoneNumber->type() & KABC::PhoneNumber::Fax ) continue;
if ( phoneNumber->type() & KABC::PhoneNumber::Cell )
fbNumber.setType(FritzBoxPhoneNumber::Mobile);
if ( phoneNumber->type() & KABC::PhoneNumber::Home )
fbNumber.setType(FritzBoxPhoneNumber::Home);
if ( phoneNumber->type() & KABC::PhoneNumber::Work )
fbNumber.setType(FritzBoxPhoneNumber::Work);
// yes there is a bug, a number can have more than one Flag
// @TODO find best numberType forthe label
bool hasAdded = fbContact.addNumber(fbNumber);
if (! hasAdded) {
m_Contacts.addContact(fbContact);
QString newName = contactI->formattedName().simplified() + " " + QString().number(count);
count++;
fbContact = FritzBoxPhoneBookContact(newName);
hasAdded = fbContact.addNumber(fbNumber);
if (! hasAdded)
kDebug() << "something really wicked happened";
}
}
m_Contacts.addContact(fbContact);
}
}
示例11: search
void SearchManager::search(const QString &pattern, const KABC::Field::List &fields, Type type)
{
mPattern = pattern;
mFields = fields;
mType = type;
KABC::Addressee::List allContacts;
mContacts.clear();
#if KDE_VERSION >= 319
KABC::AddresseeList list(mAddressBook->allAddressees());
if(!fields.isEmpty())
list.sortByField(fields.first());
allContacts = list;
#else
KABC::AddressBook::ConstIterator abIt(mAddressBook->begin());
const KABC::AddressBook::ConstIterator abEndIt(mAddressBook->end());
for(; abIt != abEndIt; ++abIt)
allContacts.append(*abIt);
#endif
#ifdef KDEPIM_NEW_DISTRLISTS
// Extract distribution lists from allContacts
mDistributionLists.clear();
KABC::Addressee::List::Iterator rmIt(allContacts.begin());
const KABC::Addressee::List::Iterator rmEndIt(allContacts.end());
while(rmIt != rmEndIt)
{
if(KPIM::DistributionList::isDistributionList(*rmIt))
{
mDistributionLists.append(static_cast<KPIM::DistributionList>(*rmIt));
rmIt = allContacts.remove(rmIt);
}
else
++rmIt;
}
typedef KPIM::DistributionList::Entry Entry;
if(!mSelectedDistributionList.isNull())
{
const KPIM::DistributionList dl = KPIM::DistributionList::findByName(mAddressBook, mSelectedDistributionList);
if(!dl.isEmpty())
{
allContacts.clear();
const Entry::List entries = dl.entries(mAddressBook);
const Entry::List::ConstIterator end = entries.end();
for(Entry::List::ConstIterator it = entries.begin(); it != end; ++it)
{
allContacts.append((*it).addressee);
}
}
}
#endif
if(mPattern.isEmpty()) // no pattern, return all
{
mContacts = allContacts;
emit contactsUpdated();
return;
}
const KABC::Field::List fieldList = !mFields.isEmpty() ? mFields : KABC::Field::allFields();
KABC::Addressee::List::ConstIterator it(allContacts.begin());
const KABC::Addressee::List::ConstIterator endIt(allContacts.end());
for(; it != endIt; ++it)
{
#ifdef KDEPIM_NEW_DISTRLISTS
if(KPIM::DistributionList::isDistributionList(*it))
continue;
#endif
bool found = false;
// search over all fields
KABC::Field::List::ConstIterator fieldIt(fieldList.begin());
const KABC::Field::List::ConstIterator fieldEndIt(fieldList.end());
for(; fieldIt != fieldEndIt; ++fieldIt)
{
if(type == StartsWith && (*fieldIt)->value(*it).startsWith(pattern, false))
{
mContacts.append(*it);
found = true;
break;
}
else if(type == EndsWith && (*fieldIt)->value(*it).endsWith(pattern, false))
{
mContacts.append(*it);
found = true;
break;
}
else if(type == Contains && (*fieldIt)->value(*it).find(pattern, 0, false) != -1)
{
mContacts.append(*it);
found = true;
break;
//.........这里部分代码省略.........
示例12: processDropEvent
void TodoPlugin::processDropEvent( QDropEvent *event )
{
const QMimeData *md = event->mimeData();
if ( KABC::VCardDrag::canDecode( md ) ) {
KABC::Addressee::List contacts;
KABC::VCardDrag::fromMimeData( md, contacts );
KABC::Addressee::List::Iterator it;
QStringList attendees;
for ( it = contacts.begin(); it != contacts.end(); ++it ) {
QString email = (*it).fullEmail();
if ( email.isEmpty() ) {
attendees.append( (*it).realName() + "<>" );
} else {
attendees.append( email );
}
}
interface()->openTodoEditor( i18nc( "@item", "Meeting" ),
QString(), QStringList(), attendees );
return;
}
if ( KCalUtils::ICalDrag::canDecode( event->mimeData() ) ) {
KCalCore::MemoryCalendar::Ptr cal( new KCalCore::MemoryCalendar( KSystemTimeZones::local() ) );
if ( KCalUtils::ICalDrag::fromMimeData( event->mimeData(), cal ) ) {
KCalCore::Incidence::List incidences = cal->incidences();
Q_ASSERT( incidences.count() );
if ( !incidences.isEmpty() ) {
event->accept();
KCalCore::Incidence::Ptr i = incidences.first();
QString summary;
if ( i->type() == KCalCore::Incidence::TypeJournal ) {
summary = i18nc( "@item", "Note: %1", i->summary() );
} else {
summary = i->summary();
}
interface()->openTodoEditor( summary, i->description(), QStringList() );
return;
}
// else fall through to text decoding
}
}
if ( md->hasText() ) {
QString text = md->text();
interface()->openTodoEditor( text );
return;
}
if ( KPIM::MailList::canDecode( md ) ) {
KPIM::MailList mails = KPIM::MailList::fromMimeData( md );
event->accept();
if ( mails.count() != 1 ) {
KMessageBox::sorry(
core(),
i18nc( "@info", "Dropping multiple mails is not supported." ) );
} else {
KPIM::MailSummary mail = mails.first();
QString txt = i18nc( "@item", "From: %1\nTo: %2\nSubject: %3",
mail.from(), mail.to(), mail.subject() );
QString uri = QLatin1String( "kmail:" ) +
QString::number( mail.serialNumber() ) + '/' +
mail.messageId();
KTemporaryFile tf;
tf.setAutoRemove( true );
tf.write( event->encodedData( "message/rfc822" ) );
interface()->openTodoEditor(
i18nc( "@item", "Mail: %1", mail.subject() ),
txt, uri, tf.fileName(), QStringList(), "message/rfc822" );
tf.close();
}
return;
}
kWarning() << QString( "Cannot handle drop events of type '%1'." ).arg( event->format() );
}