author | zautrix <zautrix> | 2004-10-20 12:05:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-20 12:05:18 (UTC) |
commit | 5cf3c1bce58a6487af166e637e54571e98156fd0 (patch) (side-by-side diff) | |
tree | 2e1ba14350aa322bb21729cf462b96e658fa6929 /kaddressbook/kaimportoldialog.cpp | |
parent | e2a0df411042d986adb31b28f9e0a2f17395358c (diff) | |
download | kdepimpi-5cf3c1bce58a6487af166e637e54571e98156fd0.zip kdepimpi-5cf3c1bce58a6487af166e637e54571e98156fd0.tar.gz kdepimpi-5cf3c1bce58a6487af166e637e54571e98156fd0.tar.bz2 |
OL import fixes
Diffstat (limited to 'kaddressbook/kaimportoldialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/kaimportoldialog.cpp | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/kaddressbook/kaimportoldialog.cpp b/kaddressbook/kaimportoldialog.cpp index 10e3c76..848d8af 100644 --- a/kaddressbook/kaimportoldialog.cpp +++ b/kaddressbook/kaimportoldialog.cpp @@ -20,24 +20,25 @@ with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qtooltip.h> #include <qframe.h> #include <qpixmap.h> #include <qlayout.h> #include <qprogressbar.h> #include <qwidgetstack.h> #include <qdatetime.h> #include <qdir.h> +#include <qregexp.h> #include <qapplication.h> #include <qhbox.h> #include <qheader.h> #include <qdatetime.h> #include <qlistview.h> #include <kdebug.h> #include <klocale.h> #include <kstandarddirs.h> #include <kmessagebox.h> #include <kfiledialog.h> @@ -258,68 +259,69 @@ void KAImportOLdialog::ol2kapiContact( _ContactItem * aItem ) addressee.setSuffix( QString::fromUcs2(aItem->GetSuffix().GetBuffer()) ); addressee.setNickName( QString::fromUcs2(aItem->GetNickName().GetBuffer()) ); QDateTime dtb = mDdate2Qdtr(aItem->GetBirthday()); if ( dtb.isValid() ) addressee.setBirthday( mDdate2Qdtr(aItem->GetBirthday())); //QString::fromUcs2(aItem->.GetBuffer()) //addressee.setMailer( const QString &mailer ); //addressee.setTimeZone( const TimeZone &timeZone ); //addressee.setGeo( const Geo &geo ); //addressee.setTitle( QString::fromUcs2(aItem->GetJobTitle().GetBuffer()) );// titel is the prefix addressee.setRole( QString::fromUcs2(aItem->GetJobTitle().GetBuffer()) ); - addressee.setOrganization( QString::fromUcs2(aItem->GetCompanyName().GetBuffer()) ); + addressee.setOrganization( QString::fromUcs2(aItem->GetCompanyName().GetBuffer()).replace( QRegExp("\\r"), "") ); QString notesStr = QString::fromUcs2(aItem->GetBody().GetBuffer()); + notesStr.replace( QRegExp("\\r"), ""); addressee.setProductId( QString::fromUcs2(aItem->GetCustomerID().GetBuffer()) ); //addressee.setRevision( const QDateTime &revision ); // addressee.setSortString( const QString &sortString ); addressee.setUrl( QString::fromUcs2(aItem->GetWebPage().GetBuffer()) ); QString tempS; tempS = QString::fromUcs2(aItem->GetNetMeetingAlias().GetBuffer())+" AT SERVER: " +QString::fromUcs2(aItem->GetNetMeetingServer().GetBuffer()); if ( tempS.length() > 12 ) addressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", tempS ); tempS = QString::fromUcs2(aItem->GetSpouse().GetBuffer()); if ( !tempS.isEmpty() ) addressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", tempS ); tempS = QString::fromUcs2(aItem->GetManagerName().GetBuffer()); if ( !tempS.isEmpty() ) addressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", tempS ); tempS = QString::fromUcs2(aItem->GetAssistantName().GetBuffer()); if ( !tempS.isEmpty() ) addressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", tempS ); tempS = QString::fromUcs2(aItem->GetDepartment().GetBuffer()); if ( !tempS.isEmpty() ) addressee.insertCustom( "KADDRESSBOOK", "X-Department", tempS ); - tempS = QString::fromUcs2(aItem->GetOfficeLocation().GetBuffer()); + tempS = QString::fromUcs2(aItem->GetOfficeLocation().GetBuffer()).replace( QRegExp("\\r"), ""); if ( !tempS.isEmpty() ) addressee.insertCustom( "KADDRESSBOOK", "X-Office",tempS ); tempS = QString::fromUcs2(aItem->GetProfession().GetBuffer()); if ( !tempS.isEmpty() ) addressee.insertCustom( "KADDRESSBOOK", "X-Profession", tempS ); dtb = mDdate2Qdtr(aItem->GetAnniversary()); if (dtb.isValid() ) { QString dt = KGlobal::locale()->formatDate( dtb.date() , true, KLocale::ISODate); addressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); } int sec = aItem->GetSensitivity() ; if ( sec > 1 )// mapping pers -> private --sec; addressee.setSecrecy( sec ); //addressee.setLogo( const Picture &logo ); //addressee.setPhoto( const Picture &photo ); //addressee.setSound( const Sound &sound ); //addressee.setAgent( const Agent &agent ); - QString cat = QString::fromUcs2( aItem->GetCategories().GetBuffer()); + QString cat = QString::fromUcs2( aItem->GetCategories().GetBuffer()).replace( QRegExp("\\r"), ""); addressee.setCategories( QStringList::split( ";", cat )); QString phoneS; phoneS = QString::fromUcs2( aItem->GetAssistantTelephoneNumber().GetBuffer()); if ( ! phoneS.isEmpty()) addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Voice ) ); phoneS = QString::fromUcs2( aItem->GetBusinessTelephoneNumber().GetBuffer()); if ( ! phoneS.isEmpty()) addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work ) ); phoneS = QString::fromUcs2( aItem->GetBusiness2TelephoneNumber().GetBuffer()); if ( ! phoneS.isEmpty()) @@ -387,182 +389,209 @@ void KAImportOLdialog::ol2kapiContact( _ContactItem * aItem ) phoneS = QString::fromUcs2( aItem->GetEmail3Address().GetBuffer()); if ( ! phoneS.isEmpty()) { addressee.insertEmail(phoneS , preferred ); preferred = false; } // is this the number of the preferred email? // long GetSelectedMailingAddress();??? KABC::Address addressHome; KABC::Address* addressAdd = &addressHome; bool insert = false; phoneS = QString::fromUcs2( aItem->GetHomeAddressCountry().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! phoneS.isEmpty()) { addressAdd->setCountry(phoneS ); insert = true; } phoneS = QString::fromUcs2( aItem->GetHomeAddressState().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! phoneS.isEmpty()) { addressAdd->setRegion(phoneS ); insert = true; } phoneS = QString::fromUcs2( aItem->GetHomeAddressCity().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! phoneS.isEmpty()) { addressAdd->setLocality(phoneS ); insert = true; } phoneS = QString::fromUcs2( aItem->GetHomeAddressPostalCode().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! phoneS.isEmpty()) { addressAdd->setPostalCode(phoneS ); insert = true; } phoneS = QString::fromUcs2( aItem->GetHomeAddressPostOfficeBox().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! phoneS.isEmpty()) { addressAdd->setPostOfficeBox(phoneS ); insert = true; } phoneS = QString::fromUcs2( aItem->GetHomeAddressStreet().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! phoneS.isEmpty()) { addressAdd->setStreet(phoneS ); insert = true; } phoneS = QString::fromUcs2( aItem->GetHomeAddress().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! phoneS.isEmpty()) { // redundant !addressAdd->setExtended(phoneS ); // insert = true; } addressAdd->setType( KABC::Address::Home ); if ( insert ) addressee.insertAddress( *addressAdd ); // ++++++++++++++++++++++ end of address KABC::Address addressWork; addressAdd = &addressWork; insert = false; phoneS = QString::fromUcs2( aItem->GetBusinessAddressCountry().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! phoneS.isEmpty()) { addressAdd->setCountry(phoneS ); insert = true; } phoneS = QString::fromUcs2( aItem->GetBusinessAddressState().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! phoneS.isEmpty()) { addressAdd->setRegion(phoneS ); insert = true; } phoneS = QString::fromUcs2( aItem->GetBusinessAddressCity().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! phoneS.isEmpty()) { addressAdd->setLocality(phoneS ); insert = true; } phoneS = QString::fromUcs2( aItem->GetBusinessAddressPostalCode().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! phoneS.isEmpty()) { addressAdd->setPostalCode(phoneS ); insert = true; } phoneS = QString::fromUcs2( aItem->GetBusinessAddressPostOfficeBox().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! phoneS.isEmpty()) { addressAdd->setPostOfficeBox(phoneS ); insert = true; } phoneS = QString::fromUcs2( aItem->GetBusinessAddressStreet().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! phoneS.isEmpty()) { addressAdd->setStreet(phoneS ); insert = true; } phoneS = QString::fromUcs2( aItem->GetBusinessAddress().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! phoneS.isEmpty()) { // redundant !addressAdd->setExtended(phoneS ); // insert = true; } addressAdd->setType( KABC::Address::Work ); if ( insert ) addressee.insertAddress( *addressAdd ); // ++++++++++++++++++++++ end of address KABC::Address addressOther; addressAdd = &addressOther; insert = false; phoneS = QString::fromUcs2( aItem->GetOtherAddressCountry().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! phoneS.isEmpty()) { addressAdd->setCountry(phoneS ); insert = true; } phoneS = QString::fromUcs2( aItem->GetOtherAddressState().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! phoneS.isEmpty()) { addressAdd->setRegion(phoneS ); insert = true; } phoneS = QString::fromUcs2( aItem->GetOtherAddressCity().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! phoneS.isEmpty()) { addressAdd->setLocality(phoneS ); insert = true; } phoneS = QString::fromUcs2( aItem->GetOtherAddressPostalCode().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! phoneS.isEmpty()) { addressAdd->setPostalCode(phoneS ); insert = true; } phoneS = QString::fromUcs2( aItem->GetOtherAddressPostOfficeBox().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! phoneS.isEmpty()) { addressAdd->setPostOfficeBox(phoneS ); insert = true; } phoneS = QString::fromUcs2( aItem->GetOtherAddressStreet().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! phoneS.isEmpty()) { addressAdd->setStreet(phoneS ); insert = true; } phoneS = QString::fromUcs2( aItem->GetOtherAddress().GetBuffer()); if ( ! phoneS.isEmpty()) { // redundant !addressAdd->setExtended(phoneS ); //insert = true; } //addressAdd->setId( ); if ( insert ) addressee.insertAddress( *addressAdd ); // ++++++++++++++++++++++ end of address KABC::Address addressMail; addressAdd = &addressMail; insert = false; phoneS = QString::fromUcs2( aItem->GetMailingAddressCountry().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! phoneS.isEmpty()) { addressAdd->setCountry(phoneS ); insert = true; } phoneS = QString::fromUcs2( aItem->GetMailingAddressState().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! phoneS.isEmpty()) { addressAdd->setRegion(phoneS ); insert = true; } phoneS = QString::fromUcs2( aItem->GetMailingAddressCity().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! phoneS.isEmpty()) { addressAdd->setLocality(phoneS ); insert = true; } phoneS = QString::fromUcs2( aItem->GetMailingAddressPostalCode().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! phoneS.isEmpty()) { addressAdd->setPostalCode(phoneS ); insert = true; } phoneS = QString::fromUcs2( aItem->GetMailingAddressPostOfficeBox().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! phoneS.isEmpty()) { addressAdd->setPostOfficeBox(phoneS ); insert = true; } phoneS = QString::fromUcs2( aItem->GetMailingAddressStreet().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! phoneS.isEmpty()) { addressAdd->setStreet(phoneS ); insert = true; } phoneS = QString::fromUcs2( aItem->GetMailingAddress().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! phoneS.isEmpty()) { // redundant ! addressAdd->setExtended(phoneS ); // insert = true; } addressAdd->setType( KABC::Address::Postal ); if ( insert ) { addressee.insertAddress( *addressAdd ); } // the following code is disabled // it does not seem to be useful #if 0 if ( insert ) { @@ -582,79 +611,88 @@ void KAImportOLdialog::ol2kapiContact( _ContactItem * aItem ) addressOther.setType( KABC::Address::Postal ); addressee.insertAddress( addressOther ); } else { addressee.insertAddress( *addressAdd ); } } } } #endif // ++++++++++++++++++++++ end of ALL addresses //GetUserProperties(); tempS = QString::fromUcs2(aItem->GetInternetFreeBusyAddress().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( !tempS.isEmpty() ) addressee.insertCustom( "KADDRESSBOOK", "X-FreeBusyUrl", tempS ); tempS = QString::fromUcs2(aItem->GetChildren().GetBuffer()); if ( !tempS.isEmpty() ) addressee.insertCustom( "KADDRESSBOOK", "X-Children", tempS ); int gen = aItem->GetGender(); if ( gen != 0 ) { // 0 undef - 1 female - 2 male if ( gen == 1 ) addressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female" ); else addressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male" ); } QString additionalInfo; QString tempAdd; tempAdd = QString::fromUcs2(aItem->GetLanguage().GetBuffer()); if ( ! tempAdd.isEmpty() ) { additionalInfo += i18n("\nLanguage: "); additionalInfo += tempAdd; } tempAdd = QString::fromUcs2(aItem->GetHobby().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! tempAdd.isEmpty() ) { additionalInfo += i18n("\nHobby: "); additionalInfo += tempAdd;; } tempAdd =QString::fromUcs2(aItem->GetPersonalHomePage().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! tempAdd.isEmpty() ) { additionalInfo += i18n("\nHomepage: "); additionalInfo += tempAdd;; } tempAdd = QString::fromUcs2(aItem->GetBillingInformation().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! tempAdd.isEmpty() ) { additionalInfo += i18n("\nBilling information: "); additionalInfo += tempAdd;; } tempAdd = QString::fromUcs2(aItem->GetCustomerID().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! tempAdd.isEmpty() ) { additionalInfo += i18n("\nCustomer ID: "); additionalInfo += tempAdd;; } tempAdd = QString::fromUcs2(aItem->GetUser1().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! tempAdd.isEmpty() ) { additionalInfo += i18n("\nUser1: "); additionalInfo += tempAdd;; } tempAdd = QString::fromUcs2(aItem->GetUser2().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! tempAdd.isEmpty() ) { additionalInfo += i18n("\nUser2: "); additionalInfo += tempAdd;; } tempAdd = QString::fromUcs2(aItem->GetUser3().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! tempAdd.isEmpty() ) { additionalInfo += i18n("\nUser3: "); additionalInfo += tempAdd;; } - tempAdd = QString::fromUcs2(aItem->GetUser4().GetBuffer()); + tempAdd = QString::fromUcs2(aItem->GetUser4().GetBuffer()); + phoneS.replace( QRegExp("\\r"), ""); if ( ! tempAdd.isEmpty() ) { additionalInfo += i18n("\nUser4: "); additionalInfo += tempAdd;; } if (!additionalInfo.isEmpty() ) { tempAdd = notesStr; notesStr = "+++++++++++++++++++++++++++\n"; notesStr += i18n("Additonal fields created\nby KA/Pi Outlook import:"); notesStr += additionalInfo; notesStr += i18n("\nEnd additonal fields created\nby KA/Pi Outlook import!\n"); notesStr += "+++++++++++++++++++++++++++\n"; notesStr += tempAdd; |