Bug 50560

Summary: address not synced correct with new address information
Product: [Unmaintained] kpilot Reporter: Thomas Vollmer <thomas-ml>
Component: Contacts ConduitAssignee: Reinhold Kainhofer <reinhold>
Status: RESOLVED FIXED    
Severity: normal CC: reinhold
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Thomas Vollmer 2002-11-11 11:39:54 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc 2.95.3 
OS:          Linux

I run into this problem in the following situation:

I have an entry on both sides (KAddressbook and palm) with empty address information and which are synced in the past. Afterwards I add a address into KAddressbook side and set the prefered address switch also. Now I do a sync and the address isn't transfered to th palm (address is still empty).
Comment 1 Reinhold Kainhofer 2003-07-31 01:36:21 UTC
Subject: kdepim/kpilot/conduits/abbrowserconduit

CVS commit by kainhofe: 

The conduit now uses a different algorithm to find the type of address on the PC to sync with.
First, if there is a preferred address (no matter if home, work or whatever), this one is synced to the handheld. If no preferred address exists, either home or work (depending on the setting in the conduit config dialog) is used for the sync. If that doesn't exist, either, the other one (work/home) is tried. If that also doesn't exist, and the address is copied to the PC, its type is set to preferred+the setting from the config dialog. 
This fixes both bugs #50560 (conduit should sync with preferred address) as well as bug #60659 (conduit should use the existing address from the PC, even if the type is not the one chosen in the config dialog). 

CCMAIL: 50560-done@bugs.kde.org, 60659-done@bugs.kde.org


  M +14 -2     abbrowser-conduit.cc   1.80
  M +2 -2      kaddressbookConduit.ui   1.18


--- kdepim/kpilot/conduits/abbrowserconduit/abbrowser-conduit.cc  #1.79:1.80
@@ -547,7 +547,19 @@ void AbbrowserConduit::setFax(Addressee 
 
 
+/** First search for a preferred  address. If we don't have one, search
+ *  for home or work as specified in the config dialog. If we don't have
+ *  such one, either, search for the other type. If we still have no luck,
+ *  return an address with preferred + home/work flag (from config dlg). */
 KABC::Address AbbrowserConduit::getAddress(const Addressee & abEntry)
 {
-        return abEntry.address((fPilotStreetHome) ?(KABC::Address::Home) :(KABC::Address::Work));
+        int type=(fPilotStreetHome)?(KABC::Address::Home):(KABC::Address::Work);
+        KABC::Address ad(abEntry.address(KABC::Address::Pref));
+        if (!ad.isEmpty()) return ad;
+        ad=abEntry.address(type);
+        if (!ad.isEmpty()) return ad;
+        ad=abEntry.address((fPilotStreetHome) ?(KABC::Address::Work):(KABC::Address::Home));
+        if (!ad.isEmpty()) return ad;
+
+        return abEntry.address(type | KABC::Address::Pref);
 }
 

--- kdepim/kpilot/conduits/abbrowserconduit/kaddressbookConduit.ui  #1.17:1.18
@@ -343,10 +343,10 @@
                         <item>
                             <property name="text">
-                                <string>Home Address</string>
+                                <string>Preferred, then Home Address</string>
                             </property>
                         </item>
                         <item>
                             <property name="text">
-                                <string>Business Address</string>
+                                <string>Preferred, then Business Address</string>
                             </property>
                         </item>