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


C++ DistributionList类代码示例

本文整理汇总了C++中DistributionList的典型用法代码示例。如果您正苦于以下问题:C++ DistributionList类的具体用法?C++ DistributionList怎么用?C++ DistributionList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DistributionList类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: kDebug

void TestDistrList::testDuplicate()
{
    kDebug() ;
    // This is a special test for the case where we have a contact and a distr list with the same name
    KABC::AddressBook *ab = KABC::StdAddressBook::self();
    KABC::Addressee addr;
    addr.setName( "foo" );
    addr.insertEmail( "[email protected]", true );
    ab->insertAddressee( addr );

#if 0 // we need a findByFormattedName
    KABC::Addressee::List addrList = ab->findByName( "foo" );
    assert( addrList.count() == 2 );

    bool a = DistributionList::isDistributionList( addrList.first() );
    bool b = DistributionList::isDistributionList( addrList.last() );
    // one is a distr list, but not both
    assert( a || b );
    //
    assert( ! ( a && b ) );
#endif

    DistributionList dl = DistributionList::findByName( ab, "foo" );
    assert( !dl.isEmpty() );
    assert( DistributionList::isDistributionList( dl ) );
    assert( dl.formattedName() == "foo" );
}
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:27,代码来源:testdistrlist.cpp

示例2:

DistributionList *DistributionListManager::list( const QString &name )
{
  DistributionList *list;
  for( list = mLists.first(); list; list = mLists.next() ) {
    if ( list->name() == name ) return list;
  }

  return 0;
}
开发者ID:,项目名称:,代码行数:9,代码来源:

示例3: listNames

QStringList DistributionListManager::listNames()
{
  QStringList names;

  DistributionList *list;
  for( list = mLists.first(); list; list = mLists.next() ) {
    names.append( list->name() );
  }

  return names;
}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例4: removeEntry

void DistributionListEditor::removeEntry()
{
  DistributionList *list = mManager->list( mNameCombo->currentText() );
  if ( !list ) return;

  EditEntryItem *entryItem =
      dynamic_cast<EditEntryItem *>( mEntryView->selectedItem() );
  if ( !entryItem ) return;

  list->removeEntry( entryItem->addressee(), entryItem->email() );
  delete entryItem;
}
开发者ID:,项目名称:,代码行数:12,代码来源:

示例5: remove

void DistributionListManager::remove( DistributionList *l )
{
  if ( !l )
    return;

  DistributionList *list;
  for( list = mLists.first(); list; list = mLists.next() ) {
    if ( list->name() == l->name() ) {
      mLists.remove( list );
      return;
    }
  }
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例6: insert

void DistributionListManager::insert( DistributionList *l )
{
  if ( !l )
    return;

  DistributionList *list;
  for( list = mLists.first(); list; list = mLists.next() ) {
    if ( list->name() == l->name() ) {
      mLists.remove( list );
      break;
    }
  }
  mLists.append( l );
}
开发者ID:,项目名称:,代码行数:14,代码来源:

示例7: changeEmail

void DistributionListEditor::changeEmail()
{
  DistributionList *list = mManager->list( mNameCombo->currentText() );
  if ( !list ) return;

  EditEntryItem *entryItem =
      dynamic_cast<EditEntryItem *>( mEntryView->selectedItem() );
  if ( !entryItem ) return;

  QString email = EmailSelectDialog::getEmail( entryItem->addressee().emails(),
                                               entryItem->email(), this );
  list->removeEntry( entryItem->addressee(), entryItem->email() );
  list->insertEntry( entryItem->addressee(), email );

  updateEntryView();
}
开发者ID:,项目名称:,代码行数:16,代码来源:

示例8: updateEntryView

void DistributionListEditor::updateEntryView()
{
  DistributionList *list = mManager->list( mNameCombo->currentText() );
  if ( !list ) return;

  mEntryView->clear();
  DistributionList::Entry::List entries = list->entries();
  DistributionList::Entry::List::ConstIterator it;
  for( it = entries.begin(); it != entries.end(); ++it ) {
    new EditEntryItem( mEntryView, (*it).addressee, (*it).email );
  }
   EditEntryItem *entryItem = dynamic_cast<EditEntryItem *>( mEntryView->selectedItem() );
   bool state = (entryItem != 0L);

   changeEmailButton->setEnabled(state);
   removeEntryButton->setEnabled(state);
}
开发者ID:,项目名称:,代码行数:17,代码来源:

示例9: cfg

bool DistributionListManager::load()
{
  KSimpleConfig cfg( locateLocal( "data", "kabc/distlists" ) );

  QMap<QString,QString> entryMap = cfg.entryMap( "DistributionLists" );
  cfg.setGroup( "DistributionLists" );

  // clear old lists
  mLists.clear();
  d->mMissingEntries.clear();

  QMap<QString,QString>::ConstIterator it;
  for( it = entryMap.constBegin(); it != entryMap.constEnd(); ++it ) {
    QString name = it.key();
    QStringList value = cfg.readListEntry( name );

    kdDebug(5700) << "DLM::load(): " << name << ": " << value.join(",") << endl;

    DistributionList *list = new DistributionList( this, name );

    MissingEntryList missingEntries;
    QStringList::ConstIterator entryIt = value.constBegin();
    while( entryIt != value.constEnd() ) {
      QString id = *entryIt++;
      QString email = *entryIt;

      kdDebug(5700) << "----- Entry " << id << endl; 
      
      Addressee a = d->mAddressBook->findByUid( id );
      if ( !a.isEmpty() ) {
        list->insertEntry( a, email );
      } else {
        missingEntries.append( qMakePair( id, email ) );
      }
      
      if ( entryIt == value.end() )
        break;
      ++entryIt;
    }

    d->mMissingEntries.insert( name, missingEntries );
  }
  
  return true;
}
开发者ID:,项目名称:,代码行数:45,代码来源:

示例10: updateEntryView

void DistributionListEditorWidget::updateEntryView()
{
    if(mNameCombo->currentText().isEmpty())
    {
        mListLabel->setText(i18n("Selected addressees:"));
    }
    else
    {
        mListLabel->setText(i18n("Selected addresses in '%1':").arg(mNameCombo->currentText()));
    }

    mEntryView->clear();

    DistributionList *list = mManager->list(mNameCombo->currentText());
    if(!list)
    {
        mEditButton->setEnabled(false);
        mRemoveButton->setEnabled(false);
        mChangeEmailButton->setEnabled(false);
        mRemoveEntryButton->setEnabled(false);
        mAddresseeView->setEnabled(false);
        mEntryView->setEnabled(false);
        return;
    }
    else
    {
        mEditButton->setEnabled(true);
        mRemoveButton->setEnabled(true);
        mAddresseeView->setEnabled(true);
        mEntryView->setEnabled(true);
    }

    DistributionList::Entry::List entries = list->entries();
    DistributionList::Entry::List::ConstIterator it;
    for(it = entries.begin(); it != entries.end(); ++it)
    {
        new EntryItem(mEntryView, (*it).addressee, (*it).email);
    }

    EntryItem *entryItem = static_cast< EntryItem * >(mEntryView->selectedItem());
    bool state = entryItem;

    mChangeEmailButton->setEnabled(state);
    mRemoveEntryButton->setEnabled(state);
}
开发者ID:serghei,项目名称:kde3-kdelibs,代码行数:45,代码来源:distributionlistdialog.cpp

示例11: i18n

void DistributionListEditorWidget::editList()
{
  TQString oldName = mNameCombo->currentText();
  bool ok;
  TQString name = KInputDialog::getText( i18n( "Distribution List" ),
    i18n( "Please change &name:" ), oldName, &ok );
  if (!ok) return;

  DistributionList *list = mManager->list( oldName );
  list->setName( name );

  mNameCombo->clear();
  mNameCombo->insertStringList( mManager->listNames() );
  mNameCombo->setCurrentItem( mNameCombo->count() - 1 );

  updateEntryView();
  slotSelectionAddresseeViewChanged();
}
开发者ID:Fat-Zer,项目名称:tdelibs,代码行数:18,代码来源:distributionlistdialog.cpp

示例12: kdDebug

void DistributionListEditor::addEntry()
{
  AddresseeItem *addresseeItem =
      dynamic_cast<AddresseeItem *>( mAddresseeView->selectedItem() );

  if( !addresseeItem ) {
    kdDebug(5700) << "DLE::addEntry(): No addressee selected." << endl;
    return;
  }

  DistributionList *list = mManager->list( mNameCombo->currentText() );
  if ( !list ) {
    kdDebug(5700) << "DLE::addEntry(): No dist list '" << mNameCombo->currentText() << "'" << endl;
    return;
  }

  list->insertEntry( addresseeItem->addressee() );
  updateEntryView();
  slotSelectionAddresseeViewChanged();
}
开发者ID:,项目名称:,代码行数:20,代码来源:

示例13: main

int main(int argc, char **argv)
{
    KAboutData aboutData("testdistlist", I18N_NOOP("Test Distribution Lists"), "0.1");
    KCmdLineArgs::init(argc, argv, &aboutData);
    KCmdLineArgs::addCmdLineOptions(options);

    KApplication app;

    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
    if(args->isSet("list"))
    {
        QString name = args->getOption("list");

        DistributionListManager *manager = new DistributionListManager(StdAddressBook::self());
        manager->load();
        DistributionList *list = manager->list(name);
        if(!list)
        {
            kdDebug() << "No list with name '" << name << "'" << endl;
            return 1;
        }
        else
        {
            kdDebug() << "RESULT: " << list->emails().join(", ") << endl;
            return 0;
        }
    }

    DistributionListEditor *editor = new DistributionListEditor(StdAddressBook::self(), 0);

    editor->show();
    app.setMainWidget(editor);

    QObject::connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));

    app.exec();

    delete editor;
}
开发者ID:serghei,项目名称:kde3-kdelibs,代码行数:39,代码来源:testdistlist.cpp

示例14: removeFromDistributions

void Guideline::removeFromDistributions(const bool force)
{
    DistributionList dlist;

    // Don't delete using rels iterator, build a distrolist.
    for (RelsList::iterator r = relationships.begin(); r != relationships.end(); r++)
    {
        Distribution *distro = dynamic_cast<Distribution *> ((*r)->distro);

        if (distro && force)
        {
            dlist.push_back(distro);
        }
    }
    dlist.sort();
    dlist.unique();
    for (DistributionList::iterator d = dlist.begin(); d != dlist.end(); d++)
    {
        (*d)->RemoveGuideline(this);
    }
}
开发者ID:skieffer,项目名称:ortho,代码行数:21,代码来源:guideline.cpp


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