本文整理汇总了C++中kabc::AddressBook::constEnd方法的典型用法代码示例。如果您正苦于以下问题:C++ AddressBook::constEnd方法的具体用法?C++ AddressBook::constEnd怎么用?C++ AddressBook::constEnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kabc::AddressBook
的用法示例。
在下文中一共展示了AddressBook::constEnd方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addresses
void KabcBridge::addresses(QStringList& result) // includes lists
{
KCursorSaver busy(KBusyPtr::busy()); // loading might take a while
KABC::AddressBook *addressBook = KABC::StdAddressBook::self( true );
KABC::AddressBook::ConstIterator it;
for( it = addressBook->constBegin(); it != addressBook->constEnd(); ++it ) {
const QStringList emails = (*it).emails();
QString n = (*it).prefix() + ' ' +
(*it).givenName() + ' ' +
(*it).additionalName() + ' ' +
(*it).familyName() + ' ' +
(*it).suffix();
n = n.simplified();
QRegExp needQuotes("[^ 0-9A-Za-z\\x0080-\\xFFFF]");
QString endQuote = "\" ";
QStringList::ConstIterator mit;
QString addr, email;
for ( mit = emails.begin(); mit != emails.end(); ++mit ) {
email = *mit;
if (!email.isEmpty()) {
if (n.isEmpty() || (email.contains( '<' ) ))
addr.clear();
else { // do we really need quotes around this name ?
if (n.contains(needQuotes) )
addr = '"' + n + endQuote;
else
addr = n + ' ';
}
if (!addr.isEmpty() && !(email.contains( '<' ) )
&& !(email.contains( '>' ) )
&& !(email.contains( ',' ) ))
addr += '<' + email + '>';
else
addr += email;
addr = addr.trimmed();
result.append( addr );
}
}
}
result += addressBook->allDistributionListNames();
result.sort();
}