当前位置: 首页>>代码示例>>C++>>正文


C++ DistributionList::removeEntry方法代码示例

本文整理汇总了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();
}
开发者ID:serghei,项目名称:kde3-kdelibs,代码行数:16,代码来源:distributionlistdialog.cpp

示例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 );
}
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:43,代码来源:testdistrlist.cpp


注:本文中的DistributionList::removeEntry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。