本文整理汇总了C++中kabc::Address::setStreet方法的典型用法代码示例。如果您正苦于以下问题:C++ Address::setStreet方法的具体用法?C++ Address::setStreet怎么用?C++ Address::setStreet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kabc::Address
的用法示例。
在下文中一共展示了Address::setStreet方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveAddress
void AddressEditDialog::saveAddress( KABC::Address &addr )
{
addr.setLocality( mLocalityEdit->text() );
addr.setRegion( mRegionEdit->text() );
addr.setPostalCode( mPostalCodeEdit->text() );
addr.setCountry( mCountryCombo->currentText() );
addr.setPostOfficeBox( mPOBoxEdit->text() );
addr.setStreet( mStreetTextEdit->text() );
addr.setLabel( mLabel );
if ( mPreferredCheckBox->isChecked() ) {
KABC::Address::List::Iterator it;
for ( it = mAddressList.begin(); it != mAddressList.end(); ++it )
(*it).setType( (*it).type() & ~( KABC::Address::Pref ) );
addr.setType( addr.type() | KABC::Address::Pref );
} else
addr.setType( addr.type() & ~( KABC::Address::Pref ) );
}
示例2:
KABC::Address VCard21Parser::readAddressFromQStringList(const QStringList &data, const int type)
{
KABC::Address mAddress;
mAddress.setType(type);
if(data.count() > 0)
mAddress.setPostOfficeBox(data[0]);
if(data.count() > 1)
mAddress.setExtended(data[1]);
if(data.count() > 2)
mAddress.setStreet(data[2]);
if(data.count() > 3)
mAddress.setLocality(data[3]);
if(data.count() > 4)
mAddress.setRegion(data[4]);
if(data.count() > 5)
mAddress.setPostalCode(data[5]);
if(data.count() > 6)
mAddress.setCountry(data[6]);
return mAddress;
}
示例3: importContacts
KABC::AddresseeList GMXXXPort::importContacts( const QString& ) const
{
KABC::AddresseeList addrList;
QString fileName = KFileDialog::getOpenFileName( ":xxport_gmx",
GMX_FILESELECTION_STRING, 0 );
if ( fileName.isEmpty() )
return addrList;
QFile file( fileName );
if ( !file.open( IO_ReadOnly ) ) {
QString msg = i18n( "<qt>Unable to open <b>%1</b> for reading.</qt>" );
KMessageBox::error( parentWidget(), msg.arg( fileName ) );
return addrList;
}
QDateTime dt;
QTextStream gmxStream( &file );
gmxStream.setEncoding( QTextStream::Latin1 );
QString line, line2;
line = gmxStream.readLine();
line2 = gmxStream.readLine();
if (!line.startsWith("AB_ADDRESSES:") || !line2.startsWith("Address_id")) {
KMessageBox::error( parentWidget(), i18n("%1 is not a GMX address book file.").arg(fileName) );
return addrList;
}
QStringList strList;
typedef QMap<QString, KABC::Addressee *> AddressMap;
AddressMap addrMap;
// "Address_id,Nickname,Firstname,Lastname,Title,Birthday,Comments,Change_date,Status,Address_link_id,Categories"
line = gmxStream.readLine();
while (!line.startsWith("####") && !gmxStream.atEnd()) {
while (1) {
strList = QStringList::split('#', line, true);
if (strList.count() >= 11)
break;
line.append('\n');
line.append(gmxStream.readLine());
};
KABC::Addressee *addr = new KABC::Addressee;
addr->setNickName(strList[1]);
addr->setGivenName(strList[2]);
addr->setFamilyName(strList[3]);
addr->setTitle(strList[4]);
if (addr->formattedName().isEmpty())
addr->setFormattedName(addr->realName());
if (checkDateTime(strList[5],dt)) addr->setBirthday(dt);
addr->setNote(strList[6]);
if (checkDateTime(strList[7],dt)) addr->setRevision(dt);
// addr->setStatus(strList[8]); Status
// addr->xxx(strList[9]); Address_link_id
// addr->setCategory(strList[10]); Categories
addrMap[strList[0]] = addr;
line = gmxStream.readLine();
}
// now read the address records
line = gmxStream.readLine();
if (!line.startsWith("AB_ADDRESS_RECORDS:")) {
kdWarning() << "Could not find address records!\n";
return addrList;
}
// Address_id,Record_id,Street,Country,Zipcode,City,Phone,Fax,Mobile,Mobile_type,Email,
// Homepage,Position,Comments,Record_type_id,Record_type,Company,Department,Change_date,Preferred,Status
line = gmxStream.readLine();
line = gmxStream.readLine();
while (!line.startsWith("####") && !gmxStream.atEnd()) {
while (1) {
strList = QStringList::split('#', line, true);
if (strList.count() >= 21)
break;
line.append('\n');
line.append(gmxStream.readLine());
};
KABC::Addressee *addr = addrMap[strList[0]];
if (addr) {
for ( QStringList::Iterator it = strList.begin(); it != strList.end(); ++it )
*it = (*it).simplifyWhiteSpace();
// strList[1] = Record_id (numbered item, ignore here)
int id = strList[14].toInt(); // Record_type_id (0=work,1=home,2=other)
int type = (id==0) ? KABC::Address::Work : KABC::Address::Home;
if (!strList[19].isEmpty() && strList[19].toInt()!=0)
type |= KABC::Address::Pref; // Preferred address (seems to be bitfield for telephone Prefs)
KABC::Address adr = addr->address(type);
adr.setStreet(strList[2]);
adr.setCountry(strList[3]);
adr.setPostalCode(strList[4]);
adr.setLocality(strList[5]);
addr->insertPhoneNumber( KABC::PhoneNumber(strList[6], KABC::PhoneNumber::Home) );
addr->insertPhoneNumber( KABC::PhoneNumber(strList[7], KABC::PhoneNumber::Fax) );
int celltype = KABC::PhoneNumber::Cell;
// strList[9]=Mobile_type // always 0 or -1(default phone).
//.........这里部分代码省略.........
示例4: read_phone_entry_highlevel
static gn_error read_phone_entry_highlevel( int index, const gn_memory_type memtype, KABC::Addressee *a )
{
gn_phonebook_entry entry;
QStringList addrlist;
QString s, country;
KABC::Address *addr;
gn_error error;
// if (index > (memstat.used + memstat.free))
// return GN_ERR_INVALIDLOCATION;
error = read_phone_entry( index, memtype, &entry );
if (error != GN_ERR_NONE)
return error;
GNOKII_DEBUG(QString("%1: %2, num=%3, location=%4, group=%5, count=%6\n").arg(index).arg(entry.name)
.arg(entry.number).arg(entry.location).arg(entry.caller_group).arg(entry.subentries_count));
// try to split Name into FamilyName and GivenName
s = QString(entry.name).simplifyWhiteSpace();
a->setFormattedName(s);
if (s.find(',')!=-1) {
addrlist = QStringList::split(',', s);
if (addrlist.count()==2) {
a->setFamilyName(addrlist[0].simplifyWhiteSpace());
a->setGivenName(addrlist[1].simplifyWhiteSpace());
} else
a->setGivenName(s);
} else {
addrlist = QStringList::split(' ', s);
if (addrlist.count()==2) {
a->setFamilyName(addrlist[1].simplifyWhiteSpace());
a->setGivenName(addrlist[0].simplifyWhiteSpace());
} else
a->setGivenName(s);
}
a->insertCustom(APP, "X_GSM_CALLERGROUP", s.setNum(entry.caller_group));
a->insertCustom(APP, "X_GSM_STORE_AT", QString("%1_%2").arg(GN_MT_ME).arg(entry.location));
// set ProductId
a->setProductId(PhoneProductId);
// evaluate timestamp (ignore timezone)
QDateTime datetime;
if (entry.date.year<1998)
datetime = QDateTime::currentDateTime();
else
datetime = QDateTime( QDate(entry.date.year, entry.date.month, entry.date.day),
QTime(entry.date.hour, entry.date.minute, entry.date.second) );
GNOKII_DEBUG(QString(" date=%1\n").arg(datetime.toString()));
a->setRevision(datetime);
if (!entry.subentries_count)
a->insertPhoneNumber(KABC::PhoneNumber(entry.number, KABC::PhoneNumber::Work | KABC::PhoneNumber::Pref));
/* scan sub-entries */
if (entry.subentries_count)
for (int n=0; n<entry.subentries_count; n++) {
QString s = QString(entry.subentries[n].data.number).simplifyWhiteSpace();
GNOKII_DEBUG(QString(" Subentry#%1, entry_type=%2, number_type=%3, number=%4\n")
.arg(n).arg(entry.subentries[n].entry_type)
.arg(entry.subentries[n].number_type).arg(s));
if (s.isEmpty())
continue;
switch(entry.subentries[n].entry_type) {
case GN_PHONEBOOK_ENTRY_Name:
a->setName(s);
break;
case GN_PHONEBOOK_ENTRY_Email:
a->insertEmail(s);
break;
case GN_PHONEBOOK_ENTRY_Postal:
addrlist = QStringList::split(',', s, true);
addr = new KABC::Address(KABC::Address::Work);
switch (addrlist.count()) {
case 4: addr->setStreet(addrlist[0].simplifyWhiteSpace());
addr->setLocality(addrlist[1].simplifyWhiteSpace());
addr->setPostalCode(addrlist[2].simplifyWhiteSpace());
country = addrlist[3].simplifyWhiteSpace();
if (!country.isEmpty())
addr->setCountry(i18n(country.utf8()));
break;
case 3: addr->setLocality(addrlist[0].simplifyWhiteSpace());
addr->setPostalCode(addrlist[1].simplifyWhiteSpace());
country = addrlist[2].simplifyWhiteSpace();
if (!country.isEmpty())
addr->setCountry(i18n(country.utf8()));
break;
default: addr->setStreet(s.simplifyWhiteSpace());
}
a->insertAddress(*addr);
delete addr;
break;
case GN_PHONEBOOK_ENTRY_Note:
if (!a->note().isEmpty())
s = "\n" + s;
a->setNote(a->note()+s);
break;
case GN_PHONEBOOK_ENTRY_Number:
//.........这里部分代码省略.........
示例5: setOtherStreet
static void setOtherStreet(const QString &value, KABC::Address &address)
{
address.setStreet(value);
}
示例6: msTNEFToVPart
//.........这里部分代码省略.........
stringProp( tnefMsg, MAPI_TAG_PR_ASSISTANT ) );
addressee.insertCustom( "KADDRESSBOOK", "X-Department",
stringProp( tnefMsg, MAPI_TAG_PR_DEPARTMENT_NAME ) );
addressee.insertCustom( "KADDRESSBOOK", "X-Office",
stringProp( tnefMsg, MAPI_TAG_PR_OFFICE_LOCATION ) );
addressee.insertCustom( "KADDRESSBOOK", "X-Profession",
stringProp( tnefMsg, MAPI_TAG_PR_PROFESSION ) );
QString s = tnefMsg->findProp( MAPI_TAG_PR_WEDDING_ANNIVERSARY ).
remove( QChar( '-' ) ).remove( QChar( ':' ) );
if ( !s.isEmpty() ) {
addressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", s );
}
addressee.setUrl( KUrl( sNamedProp( tnefMsg, MAPI_TAG_CONTACT_WEBPAGE ) ) );
// collect parts of Name entry
addressee.setFamilyName( stringProp( tnefMsg, MAPI_TAG_PR_SURNAME ) );
addressee.setGivenName( stringProp( tnefMsg, MAPI_TAG_PR_GIVEN_NAME ) );
addressee.setAdditionalName( stringProp( tnefMsg, MAPI_TAG_PR_MIDDLE_NAME ) );
addressee.setPrefix( stringProp( tnefMsg, MAPI_TAG_PR_DISPLAY_NAME_PREFIX ) );
addressee.setSuffix( stringProp( tnefMsg, MAPI_TAG_PR_GENERATION ) );
addressee.setNickName( stringProp( tnefMsg, MAPI_TAG_PR_NICKNAME ) );
addressee.setRole( stringProp( tnefMsg, MAPI_TAG_PR_TITLE ) );
addressee.setOrganization( stringProp( tnefMsg, MAPI_TAG_PR_COMPANY_NAME ) );
/*
the MAPI property ID of this (multiline) )field is unknown:
vPart += stringProp(tnefMsg, "\n","NOTE", ... , "" );
*/
KABC::Address adr;
adr.setPostOfficeBox( stringProp( tnefMsg, MAPI_TAG_PR_HOME_ADDRESS_PO_BOX ) );
adr.setStreet( stringProp( tnefMsg, MAPI_TAG_PR_HOME_ADDRESS_STREET ) );
adr.setLocality( stringProp( tnefMsg, MAPI_TAG_PR_HOME_ADDRESS_CITY ) );
adr.setRegion( stringProp( tnefMsg, MAPI_TAG_PR_HOME_ADDRESS_STATE_OR_PROVINCE ) );
adr.setPostalCode( stringProp( tnefMsg, MAPI_TAG_PR_HOME_ADDRESS_POSTAL_CODE ) );
adr.setCountry( stringProp( tnefMsg, MAPI_TAG_PR_HOME_ADDRESS_COUNTRY ) );
adr.setType( KABC::Address::Home );
addressee.insertAddress( adr );
adr.setPostOfficeBox( sNamedProp( tnefMsg, MAPI_TAG_CONTACT_BUSINESSADDRESSPOBOX ) );
adr.setStreet( sNamedProp( tnefMsg, MAPI_TAG_CONTACT_BUSINESSADDRESSSTREET ) );
adr.setLocality( sNamedProp( tnefMsg, MAPI_TAG_CONTACT_BUSINESSADDRESSCITY ) );
adr.setRegion( sNamedProp( tnefMsg, MAPI_TAG_CONTACT_BUSINESSADDRESSSTATE ) );
adr.setPostalCode( sNamedProp( tnefMsg, MAPI_TAG_CONTACT_BUSINESSADDRESSPOSTALCODE ) );
adr.setCountry( sNamedProp( tnefMsg, MAPI_TAG_CONTACT_BUSINESSADDRESSCOUNTRY ) );
adr.setType( KABC::Address::Work );
addressee.insertAddress( adr );
adr.setPostOfficeBox( stringProp( tnefMsg, MAPI_TAG_PR_OTHER_ADDRESS_PO_BOX ) );
adr.setStreet( stringProp( tnefMsg, MAPI_TAG_PR_OTHER_ADDRESS_STREET ) );
adr.setLocality( stringProp( tnefMsg, MAPI_TAG_PR_OTHER_ADDRESS_CITY ) );
adr.setRegion( stringProp( tnefMsg, MAPI_TAG_PR_OTHER_ADDRESS_STATE_OR_PROVINCE ) );
adr.setPostalCode( stringProp( tnefMsg, MAPI_TAG_PR_OTHER_ADDRESS_POSTAL_CODE ) );
adr.setCountry( stringProp( tnefMsg, MAPI_TAG_PR_OTHER_ADDRESS_COUNTRY ) );
adr.setType( KABC::Address::Dom );
addressee.insertAddress( adr );
// problem: the 'other' address was stored by KOrganizer in
// a line looking like the following one:
// vPart += "\nADR;TYPE=dom;TYPE=intl;TYPE=parcel;TYPE=postal;TYPE=work;"
// "TYPE=home:other_pobox;;other_str1\nother_str2;other_loc;other_region;"
// "other_pocode;other_country"
QString nr;