本文整理汇总了C++中kabc::addressee::List::append方法的典型用法代码示例。如果您正苦于以下问题:C++ List::append方法的具体用法?C++ List::append怎么用?C++ List::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kabc::addressee::List
的用法示例。
在下文中一共展示了List::append方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: selectedUids
KABC::Addressee::List ViewManager::selectedAddressees() const
{
KABC::Addressee::List list;
const QStringList uids = selectedUids();
QStringList::ConstIterator it;
for(it = uids.begin(); it != uids.end(); ++it)
{
KABC::Addressee addr = mCore->addressBook()->findByUid(*it);
if(!addr.isEmpty())
list.append(addr);
}
return list;
}
示例2: startDrag
void ViewManager::startDrag()
{
// Get the list of all the selected addressees
KABC::Addressee::List addrList;
const QStringList uidList = selectedUids();
if(uidList.isEmpty())
return;
kdDebug(5720) << "ViewManager::startDrag: starting to drag" << endl;
QStringList::ConstIterator it;
for(it = uidList.begin(); it != uidList.end(); ++it)
addrList.append(mCore->addressBook()->findByUid(*it));
KMultipleDrag *drag = new KMultipleDrag(this);
KABC::VCardConverter converter;
QString vcards = converter.createVCards(addrList);
// Best text representation is given by textdrag, so it must be first
drag->addDragObject(new QTextDrag(AddresseeUtil::addresseesToEmails(addrList), this));
drag->addDragObject(new KVCardDrag(vcards, this));
KTempDir tempDir;
// can't set tempDir to autoDelete, in case of dropping on the desktop, the copy is async...
if(tempDir.status() == 0)
{
QString fileName;
if(addrList.count() == 1)
fileName = addrList[ 0 ].givenName() + "_" + addrList[ 0 ].familyName() + ".vcf";
else
fileName = "contacts.vcf";
QFile tempFile(tempDir.name() + "/" + fileName);
if(tempFile.open(IO_WriteOnly))
{
tempFile.writeBlock(vcards.utf8());
tempFile.close();
KURLDrag *urlDrag = new KURLDrag(KURL(tempFile.name()), this);
drag->addDragObject(urlDrag);
}
}
drag->setPixmap(KGlobal::iconLoader()->loadIcon("vcard", KIcon::Desktop));
drag->dragCopy();
}
示例3: 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;
}
示例4: allAddressee
KABC::Addressee::List
AddressesDialog::allToAddressesNoDuplicates() const
{
KABC::Addressee::List aList = allAddressee( d->toItem );
const QStringList dList = toDistributionLists();
KABC::AddressBook* abook = KABC::StdAddressBook::self( true );
for ( QStringList::ConstIterator it = dList.constBegin(); it != dList.constEnd(); ++it ) {
const KABC::DistributionList *list = abook->findDistributionListByName( *it );
if ( !list )
continue;
const KABC::DistributionList::Entry::List eList = list->entries();
KABC::DistributionList::Entry::List::ConstIterator eit;
for( eit = eList.constBegin(); eit != eList.constEnd(); ++eit ) {
KABC::Addressee a = (*eit).addressee();
if ( !a.preferredEmail().isEmpty() && !aList.contains( a ) ) {
aList.append( a ) ;
}
}
}
return aList;
}
示例5: main
//.........这里部分代码省略.........
#endif
KDateTime::Spec spec = KDateTime::Spec::LocalZone();
GroupwiseServer server( url, user, pass, spec, 0 );
#if 1
if ( !server.login() ) {
kError() <<"Unable to login to server" << url;
return 1;
}
#endif
#if 0
server.dumpData();
#endif
#if 0
server.getCategoryList();
#endif
#if 0
server.dumpFolderList();
#endif
#if 0
QString fbUser = args->getOption( "freebusy-user" );
if ( fbUser.isEmpty() ) {
kError() <<"Need user for which the freebusy data should be retrieved.";
} else {
KCal::FreeBusy *fb = new KCal::FreeBusy;
server.readFreeBusy( "user1",
QDate( 2004, 9, 1 ), QDate( 2004, 10, 31 ), fb );
}
#endif
#if 0
KTemporaryFile temp;
temp.setautoRemove(false);
temp.open();
KCal::ResourceLocal resource( temp.fileName() );
resource.setActive( true );
KCal::CalendarResources calendar;
calendar.resourceManager()->add( &resource );
kDebug() <<"Login";
if ( !server.login() ) {
kDebug() <<"Unable to login.";
} else {
kDebug() <<"Read calendar";
if ( !server.readCalendarSynchronous( &resource ) ) {
kDebug() <<"Unable to read calendar data.";
}
kDebug() <<"Logout";
server.logout();
}
KCal::ICalFormat format;
QString ical = format.toString( &calendar );
kDebug() <<"ICALENDAR:" << ical;
#endif
#if 0
QString id = args->getOption( "addressbook-id" );
kDebug() <<"ADDRESSBOOK ID:" << id;
QStringList ids;
ids.append( id );
KABC::ResourceMemory resource;
kDebug() <<"Login";
if ( !server.login() ) {
kError() <<"Unable to login.";
} else {
kDebug() <<"Read Addressbook";
if ( !server.readAddressBooksSynchronous( ids, &resource ) ) {
kError() <<"Unable to read addressbook data.";
}
kDebug() <<"Logout";
server.logout();
}
KABC::Addressee::List addressees;
KABC::Resource::Iterator it2;
for( it2 = resource.begin(); it2 != resource.end(); ++it2 ) {
kDebug() <<"ADDRESSEE:" << (*it2).fullEmail();
addressees.append( *it2 );
}
#endif
#if 0
server.getDelta();
#endif
server.logout();
return 0;
}
示例6: readContents
bool VCard_LDIFCreator::readContents( const QString &path )
{
// read file contents
QFile file( path );
if ( !file.open( QIODevice::ReadOnly ) )
return false;
QString info;
text.truncate(0);
// read the file
QByteArray contents = file.readAll();
file.close();
// convert the file contents to a KABC::Addressee address
KABC::Addressee::List addrList;
KABC::Addressee addr;
KABC::VCardConverter converter;
addrList = converter.parseVCards( contents);
if ( addrList.count() == 0 ) {
KABC::AddresseeList l; // FIXME porting
if ( !KABC::LDIFConverter::LDIFToAddressee( contents, l ) )
return false;
// FIXME porting
KABC::AddresseeList::ConstIterator it( l.constBegin() );
for ( ; it != l.constEnd(); ++ it ) {
addrList.append( *it );
}
}
if ( addrList.count()>1 ) {
// create an overview (list of all names)
name = i18np("One contact found:", "%1 contacts found:", addrList.count());
int no, linenr;
for (linenr=no=0; linenr<30 && no<addrList.count(); ++no) {
addr = addrList[no];
info = addr.formattedName().simplified();
if (info.isEmpty())
info = addr.givenName() + ' ' + addr.familyName();
info = info.simplified();
if (info.isEmpty())
continue;
text.append(info);
text.append("\n");
++linenr;
}
return true;
}
// create card for _one_ contact
addr = addrList[ 0 ];
// prepare the text
name = addr.formattedName().simplified();
if ( name.isEmpty() )
name = addr.givenName() + ' ' + addr.familyName();
name = name.simplified();
KABC::PhoneNumber::List pnList = addr.phoneNumbers();
QStringList phoneNumbers;
for (int no=0; no<pnList.count(); ++no) {
QString pn = pnList[no].number().simplified();
if (!pn.isEmpty() && !phoneNumbers.contains(pn))
phoneNumbers.append(pn);
}
if ( !phoneNumbers.isEmpty() )
text += phoneNumbers.join("\n") + '\n';
info = addr.organization().simplified();
if ( !info.isEmpty() )
text += info + '\n';
// get an address
KABC::Address address = addr.address(KABC::Address::Work);
if (address.isEmpty())
address = addr.address(KABC::Address::Home);
if (address.isEmpty())
address = addr.address(KABC::Address::Pref);
info = address.formattedAddress();
if ( !info.isEmpty() )
text += info + '\n';
return true;
}
示例7: 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;
//.........这里部分代码省略.........