本文整理汇总了C++中kabc::Addressee::setResource方法的典型用法代码示例。如果您正苦于以下问题:C++ Addressee::setResource方法的具体用法?C++ Addressee::setResource怎么用?C++ Addressee::setResource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kabc::Addressee
的用法示例。
在下文中一共展示了Addressee::setResource方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotReadJobData
void ResourceGroupwise::slotReadJobData( KIO::Job *job , const QByteArray &data )
{
kdDebug() << "ResourceGroupwise::slotReadJobData()" << endl;
Q_UNUSED( job );
mJobData.append( data.data() );
KABC::VCardConverter conv;
QTime profile;
profile.start();
Addressee::List addressees = conv.parseVCards( mJobData );
// kdDebug() << " parsed " << addressees.count() << " contacts in " << profile.elapsed() << "ms, now adding to resource..." << endl;
Addressee::List::ConstIterator it;
for( it = addressees.begin(); it != addressees.end(); ++it ) {
KABC::Addressee addr = *it;
if ( !addr.isEmpty() ) {
addr.setResource( this );
QString remote = addr.custom( "GWRESOURCE", "UID" );
QString local = idMapper().localId( remote );
if ( local.isEmpty() ) {
idMapper().setRemoteId( addr.uid(), remote );
} else {
addr.setUid( local );
}
insertAddressee( addr );
clearChange( addr );
}
}
mJobData = QString::null;
}
示例2: slotUpdateJobData
void ResourceGroupwise::slotUpdateJobData( KIO::Job *job, const QByteArray &data )
{
kdDebug() << "ResourceGroupwise::slotUpdateJobData()" << endl;
kdDebug() << " Job address: " << job << endl;
KABC::VCardConverter conv;
mJobData.append( data.data() );
Addressee::List addressees = conv.parseVCards( mJobData );
Addressee::List::ConstIterator it;
for( it = addressees.begin(); it != addressees.end(); ++it ) {
KABC::Addressee addr = *it;
if ( !addr.isEmpty() ) {
// if added or changed
QString syncType = addr.custom( "GWRESOURCE", "SYNC" );
QString remote = addr.custom( "GWRESOURCE", "UID" );
QString local = idMapper().localId( remote );
if ( syncType == "ADD" || syncType == "UPD" )
{
addr.setResource( this );
if ( local.isEmpty() ) {
idMapper().setRemoteId( addr.uid(), remote );
} else {
addr.setUid( local );
}
insertAddressee( addr );
clearChange( addr );
}
else if ( syncType == "DEL" )
{
// if deleted
if ( !remote.isEmpty() )
{
if ( !local.isEmpty() )
{
idMapper().removeRemoteId( remote );
KABC::Addressee addrToDelete = findByUid( local );
removeAddressee( addrToDelete );
}
}
else
kdError() << "Addressee to delete did not have a remote UID, unable to find the corresponding local contact" << endl;
}
}
}
mJobData = QString::null;
}
示例3: loadAll
bool KDEAccountsFormat::loadAll( KABC::AddressBook *book,
KABC::Resource *resource,
QFile *file )
{
if ( !book || !file ) // eh?
return false;
QString uuid = "KDEAccountsEntry.";
int id = 0;
QByteArray array = file->readAll();
file->close();
QByteArray::ConstIterator it = array.begin();
QByteArray::ConstIterator end = array.end();
QByteArray::ConstIterator startLine;
QString line;
char eol = '\n';
char delim = ' ';
for ( ; it < end; it++ )
{
startLine = it;
for ( ; it && it < end && *it != eol; it++ )
{ } // find eol
uint length = it - startLine;
line = QString::fromUtf8( startLine, length ).simplified();
QString nickName;
QString name;
QString email;
int firstSpace = line.indexOf( delim );
if ( firstSpace > 0 )
{
nickName = line.left( firstSpace );
int lastSpace = line.lastIndexOf( delim );
if ( lastSpace > firstSpace )
{
email = line.mid( lastSpace +1 );
int start = firstSpace + 1;
int length = lastSpace - start;
name = line.mid( start, length );
if ( !email.isEmpty() )
{
KABC::Addressee address;
address.setNickName( nickName );
address.setNameFromString( name );
address.setOrganization("KDE Project");
address.insertCategory("KDE Developer");
address.insertEmail( email );
address.setUid( uuid + QString::number( id++ ));
address.setResource( resource );
book->insertAddressee( address );
}
}
}
}
return true;
}