本文整理汇总了C++中DistributionList::removeEntry方法的典型用法代码示例。如果您正苦于以下问题:C++ DistributionList::removeEntry方法的具体用法?C++ DistributionList::removeEntry怎么用?C++ DistributionList::removeEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DistributionList
的用法示例。
在下文中一共展示了DistributionList::removeEntry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: changeEmail
void DistributionListEditorWidget::changeEmail()
{
DistributionList *list = mManager->list(mNameCombo->currentText());
if(!list)
return;
EntryItem *entryItem = static_cast< EntryItem * >(mEntryView->selectedItem());
if(!entryItem)
return;
QString email = EmailSelector::getEmail(entryItem->addressee().emails(), entryItem->email(), this);
list->removeEntry(entryItem->addressee(), entryItem->email());
list->insertEntry(entryItem->addressee(), email);
updateEntryView();
}
示例2: testRemoveEntry
void TestDistrList::testRemoveEntry()
{
kDebug() ;
KABC::AddressBook *ab = KABC::StdAddressBook::self();
DistributionList dl = DistributionList::findByName( ab, "foo" );
assert( !dl.isEmpty() );
DistributionList::Entry::List entries = dl.entries( ab );
check( "entries count before removeEntry", QString::number( entries.count() ), "3" );
// Removing an empty entry shouldn't do anything
dl.removeEntry( KABC::Addressee() );
check( "entries count after removing empty entry", QString::number( dl.entries(ab).count() ), "3" );
KABC::Addressee addr1 = ab->findByName( "addr1" ).first();
assert( !addr1.isEmpty() );
// Removing an entry with the wrong email passed, shouldn't do anything
dl.removeEntry( addr1, "[email protected]" );
check( "entries count after removing entry with invalid email", QString::number( dl.entries(ab).count() ), "3" );
// Now remove entry correctly
dl.removeEntry( addr1 );
check( "removeEntry(addr1) worked", QString::number( dl.entries(ab).count() ), "2" );
QStringList emails = dl.emails( ab );
assert( emails.count() == 2 );
check( "first email", emails[0], "addr2 <[email protected]>" );
// Now move on to addr2. First remove with no or a wrong email (nothing should happen)
KABC::Addressee addr2 = ab->findByName( "addr2" ).first();
assert( !addr2.isEmpty() );
dl.removeEntry( addr2 );
check( "entries count after removing entry with no email", QString::number( dl.entries(ab).count() ), "2" );
// Now remove addr2 correctly
dl.removeEntry( addr2, "[email protected]" );
check( "entries count after removing addr2", QString::number( dl.entries(ab).count() ), "1" );
dl.removeEntry( addr2, "[email protected]" );
check( "entries count after removing alternate addr2", QString::number( dl.entries(ab).count() ), "0" );
assert( dl.entries(ab).isEmpty() );
assert( dl.emails(ab).isEmpty() );
assert( DistributionList::isDistributionList( dl ) );
ab->insertAddressee( dl );
}