[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/3.5/kdepim/kresources/kolab/kabc
From:       David Faure <faure () kde ! org>
Date:       2007-05-07 13:29:17
Message-ID: 1178544557.561544.14928.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 662099 by dfaure:

kolab/issue1706 (addressbook: real adress type is broken) - introducing bugs in the \
GUI due to outlook compatibility *sucks*, let's add a x-kde-type to the xml for full \
load/save roundtrip inside kaddressbook at least.


 M  +13 -6     contact.cpp  
 M  +5 -1      contact.h  


--- branches/KDE/3.5/kdepim/kresources/kolab/kabc/contact.cpp #662098:662099
@@ -508,6 +508,8 @@
 
       if ( tagName == "type" )
         address.type = e.text();
+      else if ( tagName == "x-kde-type" )
+        address.kdeAddressType = e.text().toInt();
       else if ( tagName == "street" )
         address.street = e.text();
       else if ( tagName == "pobox" )
@@ -539,6 +541,7 @@
     element.appendChild( e );
     const Address& a = *it;
     writeString( e, "type", a.type );
+    writeString( e, "x-kde-type", QString::number( a.kdeAddressType ) );
     if ( !a.street.isEmpty() )
       writeString( e, "street", a.street );
     if ( !a.pobox.isEmpty() )
@@ -1045,17 +1048,18 @@
   const KABC::Address::List addresses = addressee->addresses();
   for ( KABC::Address::List::ConstIterator it = addresses.begin() ; it != \
addresses.end(); ++it ) {  Address address;
-    address.type = addressTypeToString( (*it).type() );
+    address.kdeAddressType = (*it).type();
+    address.type = addressTypeToString( address.kdeAddressType );
     address.street = (*it).street();
     address.pobox = (*it).postOfficeBox();
     address.locality = (*it).locality();
     address.region = (*it).region();
     address.postalCode = (*it).postalCode();
     address.country = (*it).country();
-    // ## TODO not in the XML format: post-office-box and extended address info.
+    // ## TODO not in the XML format: extended address info.
     // ## KDE-specific tags? Or hiding those fields? Or adding a warning?
     addAddress( address );
-    if ( (*it).type() & KABC::Address::Pref ) {
+    if ( address.kdeAddressType & KABC::Address::Pref ) {
       preferredAddress = address.type; // home, business or other
     }
   }
@@ -1207,9 +1211,12 @@
 
   for ( QValueList<Address>::ConstIterator it = mAddresses.begin(); it != \
mAddresses.end(); ++it ) {  KABC::Address address;
-    int type = addressTypeFromString( (*it).type );
-    if ( (*it).type == mPreferredAddress )
-      type |= KABC::Address::Pref;
+    int type = (*it).kdeAddressType;
+    if ( type == -1 ) { // no kde-specific type available
+      type = addressTypeFromString( (*it).type );
+      if ( (*it).type == mPreferredAddress )
+        type |= KABC::Address::Pref;
+    }
     address.setType( type );
     address.setStreet( (*it).street );
     address.setPostOfficeBox( (*it).pobox );
--- branches/KDE/3.5/kdepim/kresources/kolab/kabc/contact.h #662098:662099
@@ -55,7 +55,11 @@
 
   struct Address {
   public:
-    QString type;
+    Address() : kdeAddressType( -1 )
+    {
+    }
+    int kdeAddressType; // KABC::Address::Type
+    QString type;       // kolab-compliant address type: home, work or other
     QString street;
     QString pobox;
     QString locality;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic