本文整理汇总了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" );
}
示例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;
}
示例3: listNames
QStringList DistributionListManager::listNames()
{
QStringList names;
DistributionList *list;
for( list = mLists.first(); list; list = mLists.next() ) {
names.append( list->name() );
}
return names;
}
示例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;
}
示例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;
}
}
}
示例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 );
}
示例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();
}
示例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);
}
示例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;
}
示例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);
}
示例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();
}
示例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();
}
示例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;
}
示例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);
}
}