author | zautrix <zautrix> | 2005-10-28 03:41:01 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-10-28 03:41:01 (UTC) |
commit | d934f3fe2a62f6a696992335124c4434cd77d990 (patch) (side-by-side diff) | |
tree | 88d33c54e3f8d08b09cf81f4cdbaeb7eb6a4bb9b /kabc | |
parent | f83a59cf4f9d0cff4111b6f5c88e88e6dc96e79e (diff) | |
download | kdepimpi-d934f3fe2a62f6a696992335124c4434cd77d990.zip kdepimpi-d934f3fe2a62f6a696992335124c4434cd77d990.tar.gz kdepimpi-d934f3fe2a62f6a696992335124c4434cd77d990.tar.bz2 |
and some bugs fixed
-rw-r--r-- | kabc/addressee.cpp | 4 | ||||
-rw-r--r-- | kabc/plugins/qtopia/qtopiaconverter.cpp | 8 | ||||
-rw-r--r-- | kabc/plugins/sharpdtm/sharpdtmconverter.cpp | 10 |
3 files changed, 11 insertions, 11 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index 661bdf6..19c78ee 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp @@ -1018,115 +1018,115 @@ QString Addressee::businessAddressLocalityLabel() QString Addressee::businessAddressRegionLabel() { return i18n("Business Address Region"); } QString Addressee::businessAddressPostalCodeLabel() { return i18n("Business Address Postal Code"); } QString Addressee::businessAddressCountryLabel() { return i18n("Business Address Country"); } QString Addressee::businessAddressLabelLabel() { return i18n("Business Address Label"); } QString Addressee::homePhoneLabel() { return i18n("Home Phone"); } QString Addressee::businessPhoneLabel() { return i18n("Work Phone"); } QString Addressee::mobilePhoneLabel() { return i18n("Mobile Phone"); } QString Addressee::mobileWorkPhoneLabel() { return i18n("Mobile2 (work)"); } QString Addressee::mobileHomePhoneLabel() { - return i18n("Mobile"); + return i18n("Mobile (Home)"); } QString Addressee::homeFaxLabel() { return i18n("Fax (Home)"); } QString Addressee::businessFaxLabel() { return i18n("Fax (Work)"); } QString Addressee::carPhoneLabel() { - return i18n("Mobile2 (work)"); + return i18n("Mobile2 (car)"); } QString Addressee::isdnLabel() { return i18n("ISDN"); } QString Addressee::pagerLabel() { return i18n("Pager"); } QString Addressee::sipLabel() { return i18n("SIP"); } QString Addressee::emailLabel() { return i18n("Email Address"); } void Addressee::setMailer( const QString &mailer ) { if ( mailer == mData->mailer ) return; detach(); mData->empty = false; mData->mailer = mailer; } QString Addressee::mailer() const { return mData->mailer; } QString Addressee::mailerLabel() { return i18n("Mail Client"); } void Addressee::setTimeZone( const TimeZone &timeZone ) { if ( timeZone == mData->timeZone ) return; detach(); diff --git a/kabc/plugins/qtopia/qtopiaconverter.cpp b/kabc/plugins/qtopia/qtopiaconverter.cpp index 39d366b..9693a68 100644 --- a/kabc/plugins/qtopia/qtopiaconverter.cpp +++ b/kabc/plugins/qtopia/qtopiaconverter.cpp @@ -156,126 +156,126 @@ QDate QtopiaConverter::dateFromString( const QString& s ) date.setYMD( year, month, day ); if ( !date.isValid() ) return QDate(); return date; } QString QtopiaConverter::dateToString( const QDate &d ) { if ( d.isNull() || !d.isValid() ) return QString::null; // ISO format in year, month, day (YYYYMMDD); e.g. 20021231 QString year = QString::number( d.year() ); QString month = QString::number( d.month() ); month = month.rightJustify( 2, '0' ); QString day = QString::number( d.day() ); day = day.rightJustify( 2, '0' ); QString str = year + month + day; return str; } bool QtopiaConverter::qtopiaToAddressee( const QDomElement& el, Addressee &adr ) { { //LR adr.setUid( el.attribute("Uid" ) ); adr.setFamilyName( el.attribute( "LastName" ) ); adr.setGivenName( el.attribute( "FirstName" ) ); adr.setAdditionalName( el.attribute( "MiddleName" ) ); adr.setSuffix( el.attribute( "Suffix" ) ); adr.setNickName( el.attribute( "Nickname" ) ); QDate date = dateFromString( el.attribute( "Birthday" ) ); if ( date.isValid() ) adr.setBirthday( date ); adr.setRole( el.attribute( "JobTitle" ) ); if ( !el.attribute( "FileAs" ).isEmpty() ) adr.setFormattedName( el.attribute( "FileAs" ) ); adr.setOrganization( el.attribute( "Company" ) ); KABC::PhoneNumber businessPhoneNum( el.attribute( "BusinessPhone" ), - KABC::PhoneNumber::Work ); + KABC::PhoneNumber::Work | KABC::PhoneNumber::Pref ); KABC::PhoneNumber businessFaxNum( el.attribute( "BusinessFax" ), KABC::PhoneNumber::Work | KABC::PhoneNumber::Fax ); KABC::PhoneNumber businessMobile( el.attribute( "BusinessMobile" ), - KABC::PhoneNumber::Work | KABC::PhoneNumber::Cell ); + KABC::PhoneNumber::Car ); KABC::PhoneNumber businessPager( el.attribute( "BusinessPager" ), - KABC::PhoneNumber::Work | KABC::PhoneNumber::Pager ); + KABC::PhoneNumber::Pager ); if ( !businessPhoneNum.number().isEmpty() ) adr.insertPhoneNumber( businessPhoneNum ); if ( !businessFaxNum.number().isEmpty() ) adr.insertPhoneNumber( businessFaxNum ); if ( !businessMobile.number().isEmpty() ) adr.insertPhoneNumber( businessMobile ); if ( !businessPager.number().isEmpty() ) adr.insertPhoneNumber( businessPager ); // Handle multiple mail addresses QString DefaultEmail = el.attribute( "DefaultEmail" ); if ( !DefaultEmail.isEmpty() ) adr.insertEmail( DefaultEmail, true ); // preferred QStringList Emails = QStringList::split(" ",el.attribute("Emails")); int i; for (i = 0;i < Emails.count();++i) { if ( Emails[i] != DefaultEmail ) adr.insertEmail( Emails[i], false ); } KABC::PhoneNumber homePhoneNum( el.attribute( "HomePhone" ), - KABC::PhoneNumber::Home ); + KABC::PhoneNumber::Home | KABC::PhoneNumber::Pref); KABC::PhoneNumber homeFax( el.attribute( "HomeFax" ), KABC::PhoneNumber::Home | KABC::PhoneNumber::Fax ); KABC::PhoneNumber homeMobile( el.attribute( "HomeMobile" ), KABC::PhoneNumber::Cell ); if ( !homePhoneNum.number().isEmpty() ) adr.insertPhoneNumber( homePhoneNum ); if ( !homeFax.number().isEmpty() ) adr.insertPhoneNumber( homeFax ); if ( !homeMobile.number().isEmpty() ) adr.insertPhoneNumber( homeMobile ); KABC::Address business( KABC::Address::Work ); business.setStreet( el.attribute( "BusinessStreet" ) ); business.setLocality( el.attribute( "BusinessCity" ) ); business.setRegion( el.attribute( "BusinessState" ) ); business.setPostalCode( el.attribute( "BusinessZip" ) ); business.setCountry( el.attribute( "BusinessCountry" ) ); if ( !business.isEmpty() ) adr.insertAddress( business ); KABC::Address home( KABC::Address::Home ); home.setStreet( el.attribute( "HomeStreet" ) ); home.setLocality( el.attribute( "HomeCity" ) ); home.setRegion( el.attribute( "HomeState" ) ); home.setPostalCode( el.attribute( "HomeZip" ) ); home.setCountry( el.attribute( "HomeCountry" ) ); if ( !home.isEmpty() ) adr.insertAddress( home ); adr.setNickName( el.attribute( "Nickname" ) ); adr.setNote( el.attribute( "Notes" ) ); { QStringList categories = QStringList::split(";", el.attribute("Categories" ) ); QString cat; QStringList added; for ( uint i = 0; i < categories.count(); i++ ) { cat = m_edit->categoryById( categories[ i ], "Contacts" ); // if name is not empty and we did not add the // cat try to repair broken files if ( !cat.isEmpty() && !added.contains( cat ) ) { adr.insertCategory( cat ); added << cat; diff --git a/kabc/plugins/sharpdtm/sharpdtmconverter.cpp b/kabc/plugins/sharpdtm/sharpdtmconverter.cpp index 4adcae4..3d429fa 100644 --- a/kabc/plugins/sharpdtm/sharpdtmconverter.cpp +++ b/kabc/plugins/sharpdtm/sharpdtmconverter.cpp @@ -87,169 +87,169 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa addr.setGivenName( db->readField(ZdbAdrs::FirstName) ); addr.setAdditionalName( db->readField(ZdbAdrs::MiddleName) ); addr.setPrefix( db->readField(ZdbAdrs::Title) ); addr.setSuffix( db->readField(ZdbAdrs::Suffix) ); QString emailstr = db->readField(ZdbAdrs::Emails); emailstr.replace( QRegExp(","), " " ); emailstr.replace( QRegExp(";"), " " ); emailstr.replace( QRegExp(":"), " " ); //qDebug("SharpDTMConverter::sharpToAddressee whats the character to seperate the emailadresses? %s ", emailstr.latin1()); QStringList emails = QStringList::split(" ", emailstr.simplifyWhiteSpace()); bool defE = false; bool found = false; for ( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { if (found ) defE = false; else found = defE = ((*it).lower() == db->readField(ZdbAdrs::DefaultEmail).lower()); addr.insertEmail( *it, defE ); } if ( ! found ) if (!db->readField(ZdbAdrs::DefaultEmail).isEmpty()) addr.insertEmail(db->readField(ZdbAdrs::DefaultEmail), true); // home if ((!db->readField(ZdbAdrs::HomeStreet).isEmpty()) || (!db->readField(ZdbAdrs::HomeCity).isEmpty()) || (!db->readField(ZdbAdrs::HomeState).isEmpty()) || (!db->readField(ZdbAdrs::HomeZip).isEmpty()) || (!db->readField(ZdbAdrs::HomeCountry).isEmpty())) { Address homeaddress; homeaddress.setType(Address::Home); //US homeaddress.setPostOfficeBox( "" ); //US homeaddress.setExtended( "" ); homeaddress.setStreet( db->readField(ZdbAdrs::HomeStreet).replace( QRegExp("\\r"), "")); homeaddress.setLocality( db->readField(ZdbAdrs::HomeCity) ); homeaddress.setRegion( db->readField(ZdbAdrs::HomeState) ); homeaddress.setPostalCode( db->readField(ZdbAdrs::HomeZip) ); homeaddress.setCountry( db->readField(ZdbAdrs::HomeCountry) ); addr.insertAddress( homeaddress ); } if (!db->readField(ZdbAdrs::HomePhone).isEmpty()) { PhoneNumber homephone; - homephone.setType( PhoneNumber::Home ); + homephone.setType( PhoneNumber::Home | PhoneNumber::Pref ); homephone.setNumber( db->readField(ZdbAdrs::HomePhone) ); addr.insertPhoneNumber( homephone ); } if (!db->readField(ZdbAdrs::HomeFax).isEmpty()) { PhoneNumber homefax; homefax.setType( PhoneNumber::Home | PhoneNumber::Fax ); homefax.setNumber( db->readField(ZdbAdrs::HomeFax) ); addr.insertPhoneNumber( homefax ); } if (!db->readField(ZdbAdrs::HomeMobile).isEmpty()) { PhoneNumber homemobile; - homemobile.setType( PhoneNumber::Home | PhoneNumber::Cell ); + homemobile.setType( PhoneNumber::Cell ); homemobile.setNumber( db->readField(ZdbAdrs::HomeMobile) ); addr.insertPhoneNumber( homemobile ); } addr.setUrl( db->readField(ZdbAdrs::HomeWebPage) ); // business if ((!db->readField(ZdbAdrs::BusinessStreet).isEmpty()) || (!db->readField(ZdbAdrs::BusinessCity).isEmpty()) || (!db->readField(ZdbAdrs::BusinessState).isEmpty()) || (!db->readField(ZdbAdrs::BusinessZip).isEmpty()) || (!db->readField(ZdbAdrs::BusinessCountry).isEmpty())) { Address businessaddress; businessaddress.setType(Address::Work); //US businessaddress.setPostOfficeBox( "" ); //US businessaddress.setExtended( "" ); businessaddress.setStreet( db->readField(ZdbAdrs::BusinessStreet).replace( QRegExp("\\r"), "") ); businessaddress.setLocality( db->readField(ZdbAdrs::BusinessCity) ); businessaddress.setRegion( db->readField(ZdbAdrs::BusinessState) ); businessaddress.setPostalCode( db->readField(ZdbAdrs::BusinessZip) ); businessaddress.setCountry( db->readField(ZdbAdrs::BusinessCountry) ); addr.insertAddress( businessaddress ); } if (!db->readField(ZdbAdrs::BusinessPhone).isEmpty()) { PhoneNumber businessphone; - businessphone.setType( PhoneNumber::Work ); + businessphone.setType( PhoneNumber::Work | PhoneNumber::Pref ); businessphone.setNumber( db->readField(ZdbAdrs::BusinessPhone) ); addr.insertPhoneNumber( businessphone ); } if (!db->readField(ZdbAdrs::BusinessFax).isEmpty()) { PhoneNumber businessfax; businessfax.setType( PhoneNumber::Work | PhoneNumber::Fax ); businessfax.setNumber( db->readField(ZdbAdrs::BusinessFax) ); addr.insertPhoneNumber( businessfax ); } if (!db->readField(ZdbAdrs::BusinessMobile).isEmpty()) { PhoneNumber businessmobile; - businessmobile.setType( PhoneNumber::Work | PhoneNumber::Cell ); + businessmobile.setType( PhoneNumber::Car ); businessmobile.setNumber( db->readField(ZdbAdrs::BusinessMobile) ); addr.insertPhoneNumber( businessmobile ); } if (!db->readField(ZdbAdrs::BusinessPager).isEmpty()) { PhoneNumber businesspager; - businesspager.setType( PhoneNumber::Work | PhoneNumber::Pager ); + businesspager.setType( PhoneNumber::Pager ); businesspager.setNumber( db->readField(ZdbAdrs::BusinessPager) ); addr.insertPhoneNumber( businesspager ); } addr.setRole( db->readField(ZdbAdrs::JobTitle) ); addr.setOrganization( db->readField(ZdbAdrs::Company) ); addr.insertCustom( "KADDRESSBOOK", "X-Profession", db->readField(ZdbAdrs::Profession) ); addr.insertCustom( "KADDRESSBOOK", "X-AssistantsName", db->readField(ZdbAdrs::Assistant) ); addr.insertCustom( "KADDRESSBOOK", "X-Department", db->readField(ZdbAdrs::Department) ); addr.insertCustom( "KADDRESSBOOK", "X-ManagersName", db->readField(ZdbAdrs::Manager) ); addr.insertCustom( "KADDRESSBOOK", "X-Office", db->readField(ZdbAdrs::Office) ); //personal addr.insertCustom( "KADDRESSBOOK", "X-SpousesName", db->readField(ZdbAdrs::Spouse) ); QString gen = db->readField(ZdbAdrs::Gender); //qDebug("SharpDTMConverter::sharpToAddressee pleas check that gender works!! : Gender: %s", gen.latin1()); //qDebug("SharpDTMConverter::sharpToAddressee: may be int db->readUshortField(\"ZdbAdrs::Gender\") is here better suited"); if (gen == "1") addr.insertCustom( "KADDRESSBOOK", "X-Gender", "male"); else if (gen == "2") addr.insertCustom( "KADDRESSBOOK", "X-Gender", "female"); else addr.insertCustom( "KADDRESSBOOK", "X-Gender", "undef"); QDate ann = KGlobal::locale()->readDate( db->readField(ZdbAdrs::Anniversary) ); if (ann.isValid()) { QString dt = KGlobal::locale()->formatDate(ann, true, KLocale::ISODate); //qDebug("qtopiaToAddressee annyversary found:%s", dt.latin1()); addr.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); } else addr.insertCustom( "KADDRESSBOOK", "X-Anniversary", " "); addr.insertCustom( "KADDRESSBOOK", "X-Children", db->readField(ZdbAdrs::Children) ); QDate birthd = KGlobal::locale()->readDate( db->readField(ZdbAdrs::Birthday) ); //qDebug("birtd %s ", birthd.toString().latin1()); if (birthd.isValid()) addr.setBirthday( birthd ); addr.setNickName( db->readField(ZdbAdrs::Nickname) ); // others //US I put opies BusinessWebPage into Ka/Pi's notes block, because no other native field is available. |