本文整理汇总了C++中addressee::List类的典型用法代码示例。如果您正苦于以下问题:C++ List类的具体用法?C++ List怎么用?C++ List使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了List类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createAgent
VCardLine VCardTool::createAgent(VCard::Version version, const Agent &agent)
{
VCardLine line("AGENT");
if(agent.isIntern())
{
if(agent.addressee() != 0)
{
Addressee::List list;
list.append(*agent.addressee());
QString str = createVCards(list, version);
str.replace("\r\n", "\\n");
str.replace(";", "\\;");
str.replace(":", "\\:");
str.replace(",", "\\,");
line.setValue(str);
}
}
else if(!agent.url().isEmpty())
{
line.setValue(agent.url());
line.addParameter("value", "URI");
}
return line;
}
示例2: load
bool ResourceEvolution::load()
{
/* doOpen never get's called :( */
if(!doOpen())
return false;
if(!mWrap)
return false; // open first!
DBIterator it = mWrap->begin();
// skip the "PAS-DB-VERSION"
for(; it != mWrap->end(); ++it)
{
if(it.key().startsWith("PAS-DB-VERSION"))
continue;
qWarning("val:%s", it.value().latin1());
VCardTool tool;
QString str = it.value().stripWhiteSpace();
Addressee::List list = tool.parseVCards(str);
if(!list.first().isEmpty())
{
Addressee adr = list.first();
adr.setResource(this);
addressBook()->insertAddressee(adr);
}
}
return true;
}
示例3: main
int main( int argc, char **argv )
{
KAboutData aboutData( "testkabcdlg", 0, ki18n( "TestKabc" ), "0.1" );
KCmdLineArgs::init( argc, argv, &aboutData );
KCmdLineOptions options;
options.add( "multiple", ki18n( "Allow selection of multiple addressees" ) );
KCmdLineArgs::addCmdLineOptions( options );
KApplication app;
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if ( args->isSet( "multiple" ) ) {
Addressee::List al = AddresseeDialog::getAddressees( 0 );
Addressee::List::ConstIterator it;
kDebug() << "Selected Addressees:";
for ( it = al.constBegin(); it != al.constEnd(); ++it ) {
kDebug() << " " << ( *it ).fullEmail();
}
} else {
Addressee a = AddresseeDialog::getAddressee( 0 );
if ( !a.isEmpty() ) {
kDebug() << "Selected Addressee:";
kDebug() << a.toString();
} else {
kDebug() << "No Addressee selected.";
}
}
}
示例4: addressees
Addressee::List AddresseeDialog::addressees()
{
Addressee::List al;
AddresseeItem *aItem = 0;
if(mMultiple)
{
QListViewItem *item = mSelectedList->firstChild();
while(item)
{
aItem = dynamic_cast< AddresseeItem * >(item);
if(aItem)
al.append(aItem->addressee());
item = item->nextSibling();
}
}
else
{
aItem = dynamic_cast< AddresseeItem * >(mAddresseeList->selectedItem());
if(aItem)
al.append(aItem->addressee());
}
return al;
}
示例5: save
bool ResourceEvolution::save(Ticket *ticket)
{
delete ticket;
if(!m_isOpen)
return false;
// just delete the summary so evolution will regenerate it
// on next start up
(void)QFile::remove(QDir::homeDirPath() + "/evolution/local/Contacts/addressbook.db.summary");
AddressBook::Iterator it;
Addressee::List list;
for(it = addressBook()->begin(); it != addressBook()->end(); ++it)
{
if((*it).resource() != this || !(*it).changed())
continue;
// remove, convert add set unchanged false
list.clear();
mWrap->remove((*it).uid());
VCardTool tool;
list.append((*it));
mWrap->add((*it).uid(), tool.createVCards(list, VCard::v2_1));
(*it).setChanged(false);
}
return true;
}
示例6: parseAgent
Agent VCardTool::parseAgent(const VCardLine &line)
{
Agent agent;
const QStringList params = line.parameterList();
if(params.findIndex("value") != -1)
{
if(line.parameter("value").lower() == "uri")
agent.setUrl(line.value().asString());
}
else
{
QString str = line.value().asString();
str.replace("\\n", "\r\n");
str.replace("\\N", "\r\n");
str.replace("\\;", ";");
str.replace("\\:", ":");
str.replace("\\,", ",");
const Addressee::List list = parseVCards(str);
if(list.count() > 0)
{
Addressee *addr = new Addressee;
*addr = list[0];
agent.setAddressee(addr);
}
}
return agent;
}
示例7: save
void VCardFormat::save( const Addressee &addressee, QFile *file )
{
VCardConverter converter;
Addressee::List vcardlist;
vcardlist.append( addressee );
QByteArray data = converter.createVCards( vcardlist );
file->write( data );
}
示例8: allAddressees
Addressee::List AddressBook::allAddressees() const
{
Addressee::List list;
ConstIterator it;
for ( it = begin(); it != end(); ++it ) {
list.append( *it );
}
return list;
}
示例9: findByName
Addressee::List Resource::findByName( const TQString &name )
{
Addressee::List results;
ConstIterator it;
for ( it = begin(); it != end(); ++it ) {
if ( name == (*it).name() )
results.append( *it );
}
return results;
}
示例10: findByCategory
Addressee::List Resource::findByCategory( const TQString &category )
{
Addressee::List results;
ConstIterator it;
for ( it = begin(); it != end(); ++it ) {
if ( (*it).hasCategory( category) ) {
results.append( *it );
}
}
return results;
}
示例11: saveAll
void VCardFormat::saveAll( AddressBook *, Resource *resource, QFile *file )
{
VCardConverter converter;
Addressee::List vcardlist;
Resource::Iterator it;
Resource::Iterator end( resource->end() );
for ( it = resource->begin(); it != end; ++it ) {
( *it ).setChanged( false );
vcardlist.append( *it );
}
QByteArray data = converter.createVCards( vcardlist );
file->write( data );
}
示例12: findByEmail
Addressee::List Resource::findByEmail( const TQString &email )
{
Addressee::List results;
const TQString lowerEmail = email.lower();
ConstIterator it;
for ( it = begin(); it != end(); ++it ) {
const TQStringList mailList = (*it).emails();
for ( TQStringList::ConstIterator ite = mailList.begin(); ite != mailList.end(); ++ite ) {
if ( lowerEmail == (*ite).lower() )
results.append( *it );
}
}
return results;
}
示例13: load
bool VCardFormat::load( Addressee &addressee, QFile *file )
{
QByteArray data;
data = file->readAll();
VCardConverter converter;
Addressee::List l = converter.parseVCards( data );
if ( ! l.first().isEmpty() ) {
addressee = l.first();
return true;
}
return false;
}
示例14: loadAll
bool VCardFormat::loadAll( AddressBook *, Resource *resource, QFile *file )
{
QByteArray data;
data = file->readAll();
VCardConverter converter;
Addressee::List l = converter.parseVCards( data );
Addressee::List::iterator itr;
for ( itr = l.begin(); itr != l.end(); ++itr ) {
Addressee addressee = *itr;
addressee.setResource( resource );
addressee.setChanged( false );
resource->insertAddressee( addressee );
}
return true;
}
示例15: testVCardRoundtrip
void RoundtripTest::testVCardRoundtrip()
{
QFETCH( QString, inputFile );
QFETCH( QString, output2_1File );
QFETCH( QString, output3_0File );
QVERIFY2( !output2_1File.isEmpty() || !output3_0File.isEmpty(),
"No reference output file for either format version" );
QFile input( QFileInfo( mInputDir, inputFile ).absoluteFilePath() );
QVERIFY( input.open( QIODevice::ReadOnly ) );
const QByteArray inputData = input.readAll();
QVERIFY( !inputData.isEmpty() );
VCardConverter converter;
const Addressee::List list = converter.parseVCards( inputData );
QVERIFY( !list.isEmpty() );
if ( !output2_1File.isEmpty() ) {
const QByteArray outputData = converter.createVCards( list, VCardConverter::v2_1 );
QFile outputFile( QFileInfo( mOutput2_1Dir, output2_1File ).absoluteFilePath() );
QVERIFY( outputFile.open( QIODevice::ReadOnly ) );
const QByteArray outputRefData = outputFile.readAll();
QCOMPARE( outputData.size(), outputRefData.size() );
const QList<QByteArray> outputLines = outputData.split( '\n' );
const QList<QByteArray> outputRefLines = outputRefData.split( '\n' );
QCOMPARE( outputLines.count(), outputRefLines.count() );
for ( int i = 0; i < outputLines.count(); ++i ) {
const QByteArray actual = outputLines[ i ];
const QByteArray expect = outputRefLines[ i ];
if ( actual != expect ) {
qCritical() << "Mismatch in v2.1 output line" << ( i + 1 );
QCOMPARE( actual.count(), expect.count() );
qCritical() << "\nActual:" << actual << "\nExpect:" << expect;
QCOMPARE( actual, expect );
}
}
}
if ( !output3_0File.isEmpty() ) {
const QByteArray outputData = converter.createVCards( list, VCardConverter::v3_0 );
QFile outputFile( QFileInfo( mOutput3_0Dir, output3_0File ).absoluteFilePath() );
QVERIFY( outputFile.open( QIODevice::ReadOnly ) );
const QByteArray outputRefData = outputFile.readAll();
// QCOMPARE( outputData.size(), outputRefData.size() );
const QList<QByteArray> outputLines = outputData.split( '\n' );
const QList<QByteArray> outputRefLines = outputRefData.split( '\n' );
QCOMPARE( outputLines.count(), outputRefLines.count() );
for ( int i = 0; i < outputLines.count(); ++i ) {
const QByteArray actual = outputLines[ i ];
const QByteArray expect = outputRefLines[ i ];
if ( actual != expect ) {
qCritical() << "Mismatch in v3.0 output line" << ( i + 1 );
QCOMPARE( actual.count(), expect.count() );
qCritical() << "\nActual:" << actual << "\nExpect:" << expect;
QCOMPARE( actual, expect );
}
}
}
}