本文整理汇总了C++中kabc::Addressee::setRevision方法的典型用法代码示例。如果您正苦于以下问题:C++ Addressee::setRevision方法的具体用法?C++ Addressee::setRevision怎么用?C++ Addressee::setRevision使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kabc::Addressee
的用法示例。
在下文中一共展示了Addressee::setRevision方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tmpZone
//.........这里部分代码省略.........
if((*i).qualifiers.contains(VCARD_TEL_PREF))
type |= PhoneNumber::Pref;
// if ( (*i).qualifiers.contains( VCARD_TEL_VOICE ) )
// type |= PhoneNumber::Voice;
if((*i).qualifiers.contains(VCARD_TEL_FAX))
type |= PhoneNumber::Fax;
if((*i).qualifiers.contains(VCARD_TEL_MSG))
type |= PhoneNumber::Msg;
if((*i).qualifiers.contains(VCARD_TEL_CELL))
type |= PhoneNumber::Cell;
if((*i).qualifiers.contains(VCARD_TEL_PAGER))
type |= PhoneNumber::Pager;
if((*i).qualifiers.contains(VCARD_TEL_BBS))
type |= PhoneNumber::Bbs;
if((*i).qualifiers.contains(VCARD_TEL_MODEM))
type |= PhoneNumber::Modem;
if((*i).qualifiers.contains(VCARD_TEL_CAR))
type |= PhoneNumber::Car;
if((*i).qualifiers.contains(VCARD_TEL_ISDN))
type |= PhoneNumber::Isdn;
if((*i).qualifiers.contains(VCARD_TEL_VIDEO))
type |= PhoneNumber::Video;
if((*i).qualifiers.contains(VCARD_TEL_PCS))
type |= PhoneNumber::Pcs;
}
addressee.insertPhoneNumber(PhoneNumber((*i).parameters[0], type));
}
}
// set the addressee's addresses
for(QValueListIterator< VCardLineX > i = vCard->_vcdata->begin(); i != vCard->_vcdata->end(); ++i)
{
if((*i).name == VCARD_ADR)
{
int type = 0;
if((*i).qualified)
{
if((*i).qualifiers.contains(VCARD_ADR_DOM))
type |= Address::Dom;
if((*i).qualifiers.contains(VCARD_ADR_INTL))
type |= Address::Intl;
if((*i).qualifiers.contains(VCARD_ADR_POSTAL))
type |= Address::Postal;
if((*i).qualifiers.contains(VCARD_ADR_PARCEL))
type |= Address::Parcel;
if((*i).qualifiers.contains(VCARD_ADR_HOME))
type |= Address::Home;
if((*i).qualifiers.contains(VCARD_ADR_WORK))
type |= Address::Work;
if((*i).qualifiers.contains(VCARD_ADR_PREF))
type |= Address::Pref;
}
addressee.insertAddress(readAddressFromQStringList((*i).parameters, type));
}
}
// set the addressee's delivery label
tmpStr = vCard->getValue(VCARD_LABEL);
if(!tmpStr.isEmpty())
{
tmpStr.replace("\r\n", "\n");
Address tmpAddress;
tmpAddress.setLabel(tmpStr);
addressee.insertAddress(tmpAddress);
}
// set the addressee's notes
tmpStr = vCard->getValue(VCARD_NOTE);
tmpStr.replace("\r\n", "\n");
addressee.setNote(tmpStr);
// set the addressee's timezone
tmpStr = vCard->getValue(VCARD_TZ);
TimeZone tmpZone(tmpStr.toInt());
addressee.setTimeZone(tmpZone);
// set the addressee's geographical position
tmpList = vCard->getValues(VCARD_GEO);
if(tmpList.count() == 2)
{
tmpStr = tmpList[0];
float glat = tmpStr.toFloat();
tmpStr = tmpList[1];
float glong = tmpStr.toFloat();
Geo tmpGeo(glat, glong);
addressee.setGeo(tmpGeo);
}
// set the last revision date
tmpStr = vCard->getValue(VCARD_REV);
addressee.setRevision(VCardStringToDate(tmpStr));
// set the role of the addressee
tmpStr = vCard->getValue(VCARD_ROLE);
addressee.setRole(tmpStr);
delete vCard;
return addressee;
}
示例2: 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).
//.........这里部分代码省略.........
示例3: fromXml
KABC::Addressee Contact::fromXml(const QString &xml)
{
QDomDocument document;
QString errorMsg;
int errorLine, errorColumn;
if(!document.setContent(xml, true, &errorMsg, &errorLine, &errorColumn))
{
qDebug("Error parsing XML in Scalix::Contact::fromXml: %s (%d,%d)", errorMsg.latin1(), errorLine, errorColumn);
return KABC::Addressee();
}
QDomElement contactElement = document.documentElement();
if(contactElement.tagName() != "contact")
{
if(contactElement.tagName() == "distlist")
{
const QDomNodeList names = contactElement.elementsByTagName("display_name");
const QString listName = (names.count() == 1 ? names.item(0).toElement().text() : "Scalix Dummy List");
/**
* As we can't provide distribution list functionality we store the entry
* here and return it on save.
*/
KPIM::DistributionList list;
list.setName(listName);
if(!s_distListMap)
sd.setObject(s_distListMap, new QMap<QString, QString>());
s_distListMap->insert(list.uid(), xml);
return list;
}
else
{
qDebug("Error interpreting XML in Scalix::Contact::fromXml: no 'contact' or 'distlist' tag found");
return KABC::Addressee();
}
}
QString emails[ 3 ];
KABC::Address homeAddress(KABC::Address::Home);
KABC::Address workAddress(KABC::Address::Work);
KABC::Address otherAddress(KABC::Address::Dom);
KABC::Addressee addr;
setCustom("comes_from_scalix", "true", addr);
QDomNode node = contactElement.firstChild();
while(!node.isNull())
{
QDomElement element = node.toElement();
if(!element.isNull())
{
if(element.tagName() == "direct_ref")
addr.setUid(element.text());
else if(element.tagName() == "sensitivity")
setCustom("sensitivity", element.text(), addr);
else if(element.tagName() == "is_recurring")
setCustom("is_recurring", element.text(), addr);
else if(element.tagName() == "reminder_set")
setCustom("reminder_set", element.text(), addr);
else if(element.tagName() == "send_rich_info")
setCustom("send_rich_info", element.text(), addr);
else if(element.tagName() == "last_modification_time")
addr.setRevision(QDateTime::fromString(element.text(), Qt::ISODate));
// name
else if(element.tagName() == "display_name_prefix")
addr.setPrefix(element.text());
else if(element.tagName() == "first_name")
addr.setGivenName(element.text());
else if(element.tagName() == "middle_name")
addr.setAdditionalName(element.text());
else if(element.tagName() == "last_name")
addr.setFamilyName(element.text());
else if(element.tagName() == "suffix")
addr.setSuffix(element.text());
else if(element.tagName() == "file_as")
addr.setFormattedName(element.text());
else if(element.tagName() == "nickname")
addr.setNickName(element.text());
// job
else if(element.tagName() == "web_page_address")
addr.setUrl(element.text());
else if(element.tagName() == "company_name")
addr.setOrganization(element.text());
else if(element.tagName() == "job_title")
addr.setTitle(element.text());
// emails
else if(element.tagName().startsWith("email"))
{
if(element.tagName() == "email1_address")
emails[ 0 ] = element.text();
else if(element.tagName() == "email2_address")
emails[ 1 ] = element.text();
else if(element.tagName() == "email3_address")
//.........这里部分代码省略.........